Commit Graph

288 Commits

Author SHA1 Message Date
Christoph Heiss
b9c06cb119 common: options: allow user-supplied domain for network options
Add an optional parameter to allow specifying a domain, which will take
precedence over both the DHCP-supplied domain (if any) and the hardcoded
default domain.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2025-04-04 17:54:19 +02:00
Christoph Heiss
a51f65e731 tui, common: move network option tests to correct crate
The `NetworkOptions` struct was moved here in

  5362c05cd ("common: copy common code from tui-installer")

and

  86c48f76f ("tui: switch to common crate")

but the tests were forgotten at the original place.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2025-04-04 17:17:35 +02:00
Christoph Heiss
8e25640574 tui: bootdisk: always return proper value for default zfs max arc size
In preparation for fixing #6285 [0].

`0` means to just skip writing the module parameter. But (especially)
with the upcoming change in ZFS 2.3 - which makes the size basically
that of the system memory minus 1 GiB - we want to always write some
value.

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=6285

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2025-04-04 14:55:05 +02:00
Christoph Heiss
10d5c08293 gtk, tui: leave 1 GiB headroom for OS in ZFS ARC max size edit view
We always want to leave a little bit of extra headroom
for the OS.

This follows commit 91be6a7 [0], which adjusts the clamp calculation.
Reflect that here in the user-facing UI as well.

[0] https://git.proxmox.com/?p=pve-installer.git;a=commitdiff;h=91be6a7

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2025-04-04 10:48:05 +02:00
Christoph Heiss
7193d34159 tui: use default ZFS ARC maximum size from runtime enviroment
Now that the value is pre-calculated in the low-level installer and
written to `run-env.json`, use it from there instead of calculating it
separately - thus having a single source of truth.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2025-04-04 10:35:59 +02:00
Christoph Heiss
a1575df428 tree-wide: rust: run cargo fmt
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>
2025-02-28 16:04:40 +01:00
Christoph Heiss
c305be5e91 tree-wide: rust: update to 2024 edition
Updates (and unifies) the edition across the workspace to 2024.

No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2025-02-28 16:04:40 +01:00
Christoph Heiss
7d72ce20b7 tui: raise minimum root password length to 8 characters
.. in accordance with current NIST recommendations [0].

It's 2024; so reasonable to expect an 8-character-password at the
minimum.

[0] https://pages.nist.gov/800-63-4/sp800-63b.html#passwordver

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2025-02-24 12:02:09 +01:00
Christoph Heiss
7f8d2f3d80 common: convert InstallRootPassword into an enum
It's more appropriate to use an enum for that type of data, since the
users must set exactly one of both variants. Note that while one could
theoretically have the case where struct members get set to `None`
before this patch, in practice this was already caught by the
`verify_email_and_root_password_settings` function. So the change
makes this invariant more obvious and also a bit more ergonomic to
handle.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
 [TL: describe why this change has no semantic user visible effect]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2025-02-24 12:01:49 +01:00
Christoph Heiss
97c12b5493 tree-wide: add workspace-level cargo package version
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>
2025-01-28 15:31:00 +01:00
Christoph Heiss
18a1b8c20d tui: options: simplify unit-test setup
We already have `SetupInfo::mocked()` since commit c3c9282 ("common: add
mocked variants for setup and ISO related info structs"), so use that.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-12-10 18:00:24 +01:00
Christoph Heiss
681aaefab7 tui: use pretty_assertions for object equal asserts
Using the previously introduced `pretty_assertions` crates for object
comparisons improves developer UX quite a bit, making failures easier to
observe and quickly reason about.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-12-03 18:17:46 +01:00
Christoph Heiss
684bbaa2b9 tree-wide: fix rustdoc warnings
Mostly URLs, which need to be surrounded by < > to be properly
formatted.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-12-03 18:16:05 +01:00
Christoph Heiss
2489caa271 tui: tests: catch EOF from proxmox-low-level-installer early
This can happen if e.g. not all required testdata is available, such as
.cd-info - in which case proxmox-low-level-installer will fail early
with

  could not open CD info file '/.cd-info' - No such file or directory at Proxmox/Install/ISOEnv.pm line 95.

Currently, next_msg() would just be recursively called until the stack
overflowed in such a case.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-25 23:21:51 +01:00
Christoph Heiss
5241b6c45f low-level: stdio: fix: make progress text properly optional
.. such that receivers can differentiate between these two cases more
clearly.

Sometimes, the `progress` sub does not get passed a text (on purpose!),
just updating the progress ratio. This would cause log messages to be
written out which could indicate missing text and look rather weird.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-25 23:21:51 +01:00
Christoph Heiss
d564919315 auto, tui: move low-level installer message struct to common crate
.. effectively de-duplicating the struct, which currently is defined in
both the auto-installer and the tui-installer separately.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-25 23:21:51 +01:00
Christoph Heiss
7698b8240a fix #5579: setup: introduce 'first_boot' low-level installer options
.. to enable the setup of the 'proxmox-first-boot' service, as well as
optionally setting the ordering.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-18 22:29:23 +01:00
Christoph Heiss
687aa6772b tree-wide: run rustfmt, fix clippy warnings
No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-14 20:52:18 +01:00
Christoph Heiss
e3ecca02d9 tree-wide: add serde derive where actually needed
Fixes building each crate on their own.

In a full build (e.g. `make deb`), everything pulls in serde with the
`derive` feature anyway and thus does not exihibit any build failures.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-12 14:51:11 +01:00
Christoph Heiss
524c796ceb tui: tests: fix reading ui messages from low-level installer
This actually broke with commit 723afe2 - this patch was quite old
(18.10.2023) and these tests were introduced some time after sending it,
thus is not adjusted for it.

Fix itself is pretty simple, simply ignore non-JSON/invalid message from
the low-level installer, much like the actual progression code does it.

Fixes: 723afe2 ("run env: always re-create run env file in test mode")
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-12 14:50:05 +01:00
Christoph Heiss
7a8d69c1e5 tree-wide: convert some more crates to use workspace dependencies
No functional changes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-11 18:20:19 +01:00
Christoph Heiss
a42a9db209 tui: expose arc size setting for zfs bootdisks for all products
For non-PVE products, simply use the ZFS defaults (aka. 50%) and leave
unset, if the user never touches that setting.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-10 19:50:48 +01:00
Christoph Heiss
f9be9834ae tui: NumericEditView: add optional placeholder value
Enables to add an optional placeholder value to `NumericEditView`, which
will be displayed in a different (darker) color and not returned by
`.get_content*()`.

Can be used for having default values in the TUI, but with different
handling in the back.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-10 19:50:48 +01:00
Christoph Heiss
9416ee218b fix #5250: tui: expose new btrfs compress option
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-10 19:41:55 +01:00
Christoph Heiss
80b6a2de5f fix #5250: install: config: add new btrfs_opts with compress config option
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-10 19:41:55 +01:00
Christoph Heiss
e143655b08 common: setup: serialize target_hd as string explicitly
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-10 19:35:47 +01:00
Christoph Heiss
6d9929b532 tui: use email regex from HTML specification for validation
That regex should be a lot more accurate in what it allows - if it's
good enough for the HTML spec, it should be for us too.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-10 19:17:07 +01:00
Christoph Heiss
1662cdaf15 tui: fix new clippy lint
warning: unnecessary hashes around raw string literal
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_raw_string_hashes
   = note: `#[warn(clippy::needless_raw_string_hashes)]` on by default

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-11-10 19:17:07 +01:00
Christoph Heiss
b4035495af tui: show background header on fatal setup error
This was missing, as it was only applied for the main installation UI -
the setup error has its own screen setup codepath entirely.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>
2024-10-30 09:57:09 +01:00
Christoph Heiss
596595d3d6 debian: bump cursive to 0.21
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-08-13 13:07:44 +02:00
Christoph Heiss
80f3e87c48 tui: switch cursive to crossterm backend
Development of crossterm seems to be more active, has more frequent
releases and is also the default backend for cursive - so overall also
probably better supported/tested.

Additionally, it feels a bit more snappier/less flickery, probably due
to buffering writes to the TTY layer unlike termion.

As this effects only the way cursive talks to the TTY, this has no
visible change on the TUI itself.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-08-13 13:07:44 +02:00
Christoph Heiss
bdca138e0e {auto, tui}-installer: adapt to new root_password plain/hashed setup option
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Tested-by: Theodor Fumics <theodor.fumics@gmx.net>
2024-07-22 18:40:34 +02:00
Christoph Heiss
7d248c03d7 tui-installer: remove Debug implementation for password options
So we never accidentally show/log the password somewhere. Need to drop
it from `InstallerOptions` in turn too, but it's never used currently
anyway.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Tested-by: Theodor Fumics <theodor.fumics@gmx.net>
2024-07-22 18:40:34 +02:00
Christoph Heiss
e1e3ac0520 common: move PasswordOptions type to tui crate
It's only used internally there anyway, so make it slightly less
confusing.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Tested-by: Theodor Fumics <theodor.fumics@gmx.net>
2024-07-22 18:40:34 +02:00
Christoph Heiss
0e1d973b3d install: config: rename option lvm_auto_rename -> existing_storage_auto_rename
As this is an internal option for the low-level installer anyway, no
real functional changes here.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Aaron Lauterer <a.lauterer@proxmox.com>
Tested-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-07-16 17:51:41 +02:00
Thomas Lamprecht
f7b9a06759 tui: add missing lifetime annotation for constant string reference
This produces as warning that will become a hard-error in the future.
See also: https://github.com/rust-lang/rust/issues/115010

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-07-04 11:27:02 +02:00
Christoph Heiss
c359d14fdb tui: bootdisk: use tabbed view for disk options on small screens
It's currently only activated for small (<=80 columns) displays, to make
disk selection a lot more usable in these cases. This mostly affects
serial console installation, but possibly also installations using a
virtual screen via IPMI/BMC.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
2024-07-04 11:24:12 +02:00
Christoph Heiss
d388c74344 tui: views: add new TabbedView component
Add a tabbed view component, for usage in the advanced disk options
dialog when selecting ZFS or Btrfs (for now). Works pretty much the same
as its GUI counterpart, as much as that is possible.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
2024-07-04 11:24:12 +02:00
Christoph Heiss
d4535cf0a6 tui: bootdisk: align btrfs dialog interface with zfs equivalent
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
2024-07-04 11:24:12 +02:00
Christoph Heiss
deb9a16f2a tui: fix some comment typos
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
2024-07-04 11:24:12 +02:00
Christoph Heiss
9a5b563dfe auto-installer: move ssh keys setup to low-level installer
.. thereby, also fixing a accidental shell injection.

Since run_cmd{,s}() is nowhere else used anymore, they can be removed
too.

Also mostly reverts commit

  5878dc4ae "auto-installer: handle auto-reboot info messages directly"

in the process too.

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-04-23 17:24:24 +02:00
Christoph Heiss
1a2f087ec4 tui: update screen during installation only when necessary
This can significantly reduces CPU load and even speed up the
installation a lot on single-core machines. While the latter may not be
a realistic target for obvious reasons, lowering overall CPU usage is
always a good thing.

Also helps with flickering during the installation process quite a bit
too.

E.g. a test installation on a single-core VM goes down from 47:35 min
w/o the patch to 2:26 min w/ the patch, a ~94%(!) decrease in time.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-04-23 16:08:19 +02:00
Christoph Heiss
ec880798ba auto-installer: use new lvm_auto_rename option to avoid prompt
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-04-22 14:51:16 +02:00
Thomas Lamprecht
e0cac81644 tree-wide: cargo fmt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 14:31:37 +02:00
Aaron Lauterer
d7f19ffd7e common: tui: use BTreeMap for predictable ordering
necessary for the disk selection and network interfaces maps to have
tests with results that can be compared without much additional effort.

Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 14:31:37 +02:00
Aaron Lauterer
6239aaa025 tui: common: move InstallConfig struct to common crate
It describes the data structure expected by the low-level-installer.
We do this so we can use it in more than the TUI installer, for example
the planned auto installer.

Make the members public so we can easily implement a custom From method
for each dependent crate.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-22 14:31:37 +02:00
Christoph Heiss
22de6e5f9f tui: install_progress: write low-level non-JSON messages to separate file
The low-level installer prints quite a few messages during the install
to its stdout which are not JSON-formatted and thus parseable.

Thus catch them early and write them to `/tmp/install-low-level.log`, to
avoid polluting the log tty at /dev/tty2 with mostly useless parse
errors.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-02-27 16:43:42 +01:00
Christoph Heiss
240f1f0085 tui: install progress: add tests for UI^2 stdio protocol
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-02-24 18:00:17 +01:00
Christoph Heiss
8fcdc5b266 tui, ui: switch over to JSON-based protocol
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2024-02-23 17:34:36 +01:00
Christoph Heiss
e9e6cfea3a tui: preserve autoreboot checkbox state when switching views
Instead of reading the checkbox when continuing to the next screen, save
its toggle status to the installer state instead on change.

Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
2023-11-21 13:11:50 +01:00