The 2024 style guide changed some things, which causes quite some churn. Most of
boils down to the changed import order, now choosing types before function
items - which is the other way round then before.
No functional changes.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Means that all CLIs will now have the correct version compiled-in.
This is at least very much relevant for
`proxmox-auto-install-assistant`, which we distribute separately as a
normal binary/package.
Currently, `proxmox-auto-install-assistant --version` always reports
'0.1.0', thus users have to effectively fall back to their system
package manager (if installed via such) to identify the correct version.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
For the first-boot hook, the check from the auto-installer can be easily
re-used.
For the locale, as we now have that information available as JSON,
include that file in the assistant and use it to verify the answer file
settings.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Adds a new parameter `--on-first-boot` to the `prepare-iso` command, to
specify a file to bake into the ISO.
To later use it with the auto-installer, the following must be set in
the answer file:
[first-boot]
source = "from-iso"
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
udev properties are very easy to parse and can be done by doing a
line-based scan and matching the prefix, splitting once for properties.
Avoids the use of regexes and signicantly reduces binary size by about
-46%(!).
Tested by comparing the output of `proxmox-auto-install-assistant
device-info`, running it before and after the changes.
Stripped binary size for release builds:
before: 3869304 bytes ~ 3.69MiB
after: 2091608 bytes ~ 1.99MiB
text data bss dec hex filename
3580692 280920 545 3862157 3aee8d assistant-before
2031252 52336 505 2084093 1fccfd assistant-after
No functional changes.
Reviewed-By: Aaron Lauterer <a.lauterer@proxmox.com>
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
This has been requested by at least one user one user [0] and definitely
makes sense, esp. for BMCs/IPMIs where one might not be able to control
the partition label.
[0] https://forum.proxmox.com/threads/proxmox-ais-question-request.153043/post-695689
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-By: Aaron Lauterer <a.lauterer@proxmox.com>
while it works with two, one is what is shown in the man page and what
we already use for the other paramters.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
By mapping files into the ISO, the UUID for the partitions change as
they depend on the timestamp. The result is, that grub cannot find its
partition anymore and the user ends up on the grub shell.
This only happens when booting from a blockdev in UEFI mode. E.g. a USB
flash drive. Alternatively one can `dd` the ISO to a small (2GiB) VM
disk and mark it as the first boot device.
When booting in legacy mode or via CDROM (e.g. pass through via IPMI),
it worked.
Xorriso can report the commands needed to recreate the source ISO. The
'-volume_date uuid' is the one needed to override the same UUIDs. We
therefore read it first from the source iso and pass it as parameter
whenever we inject a file into the iso.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
this belongs after the ':' otherwise the output looks weird:
[..] can be
: * integrated into [..]
* needs to be [..]
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(v)FAT is still the most popular FS on removable medias like USB pen
drives, so we need to cope with its legacy..
So, rename the label that we look for again to PROXMOX-AIS, as that
still should allow admins to better recognize what this might be for
by having the "Proxmox" context and the rest is just hard to get
sensible meaning in, so do not bother to invent elaborate explanations
of why AIS is a good choice, it isn't but it's about the best thing
that one can do in these constraints.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
The directory where the input ISO is on might be read-only and so it
makes more sense to use the output directory to derive the default tmp
directory from.
Note that by default the output directory is the same as the one from
the input file, so this commit won't have a change for those that do
not override the output file explicitly.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Use input and output for the input and output files, drop various
short options, we can always re-add them later and forcing the use of
the more telling long options is a UX gift to sites with multiple
admins working on this stuff.
Further rename the "install-mode" to "fetch-from" as the option does
not changes the installation mode but rather the mode where the answer
file is fetched from.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
It simpler to force the user to chose, as then they will always know
where an ISO pulls the answer file from without any complex automatic
fallback logic, which might be also undesired, especially in
environments where one has not full control (trust) over the network.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
looking through /usr/lib/udev/rules.d there are at least some which
also have digits (eg. `IEEE1394_...`), so let's just match [^=]+ for
the variable name.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This fixes a bug for the case where the answer file was named
"answer.toml", as then the code tried to copy the file to itself,
which just caused the file being truncated.
This was quite confusing for the user, as the validation of the answer
file happened before the copy step, so one would see that it got
correctly validated only to then turn up empty inside the ISO..
While this was introduced through a14a934 ("assistant: perpare-iso
avoid separate directory and make less verbose"), copying the answer
file before injecting it into the ISO was never required, so just use
the source file directly.
Note that this is still a bit racy w.r.t. validation and inserting
into the ISO, to fix that we'd need to pass around empty files or
write the content directly, both not worth it for now.
Fixes: a14a934
Reported-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
A debug print is not only shorter code but also quotes the path
correctly, making it nicer for the user to copy (e.g., if the path is
at the end of a sentence the trailing dot could be misinterpreted as
being part of the path otherwise)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
The new one is far from perfect either, but labels can be at max 16
characters, so that's what we have to work with.
It now is slightly easier to read due to the hyphen separation and
contains the following relevant info:
- proxmox spelled out in full, so anybody seeing that label has a good
chance to narrow down what it could do already by a lot
- inst is a bit cryptic, but that Proxmox has a installer is a easy to
find out fact
- src should hopefully relay that this is the source of
(configuration) for something related to a installer by proxmox
But yeah, please don't limit IDs or names to less than 32, ideally
even 64, characters, that's the bare minimum to get some expressive
names that can have actual meaning..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>