aboutsummaryrefslogtreecommitdiff
path: root/installer
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-19 02:19:04 -0500
committerCraig Jennings <c@cjennings.net>2026-05-19 02:19:04 -0500
commitb6d737fc9e3cee641afe7b855c5356122537850b (patch)
tree75d33c59bcee47fe97a0fd0ace5398de98dd6c9f /installer
parent33579ee72ed97a671a898267555a50fb8411144b (diff)
downloadarchangel-b6d737fc9e3cee641afe7b855c5356122537850b.tar.gz
archangel-b6d737fc9e3cee641afe7b855c5356122537850b.zip
refactor: wire validate_config into the unattended install path
validate_config in lib/config.sh was unreachable from main(). Its empty-field checks duplicated four lines in gather_input's unattended branch. validate_config also has two checks gather_input doesn't: that every entry in SELECTED_DISKS is a real block device, and that TIMEZONE exists under /usr/share/zoneinfo. Neither check ever ran. A config with a typo'd disk path slipped past gather_input and surfaced as an obscure sgdisk error inside the destructive partitioning step. I wired validate_config into main() after validate_filesystem, gated on UNATTENDED so it only runs against an already-loaded config. I dropped the four duplicate empty-field checks from gather_input's unattended branch. The filesystem-specific passphrase checks stay there because they're coupled to the FILESYSTEM branch logic. validate_config reports every missing field at once instead of dying on the first. A config with five missing fields tells you all five in one pass. I removed the four corresponding gather_input bats tests. validate_config's existing unit tests in test_config.bats already cover their assertions. Bats: 178 → 174.
Diffstat (limited to 'installer')
-rwxr-xr-xinstaller/archangel8
1 files changed, 3 insertions, 5 deletions
diff --git a/installer/archangel b/installer/archangel
index beee692..939c686 100755
--- a/installer/archangel
+++ b/installer/archangel
@@ -99,11 +99,8 @@ filesystem_preflight() {
gather_input() {
if [[ "$UNATTENDED" == true ]]; then
- # Validate required config values
- if [[ -z "$HOSTNAME" ]]; then error "Config missing required: HOSTNAME"; fi
- if [[ -z "$TIMEZONE" ]]; then error "Config missing required: TIMEZONE"; fi
- if [[ -z "$ROOT_PASSWORD" ]]; then error "Config missing required: ROOT_PASSWORD"; fi
- if [[ ${#SELECTED_DISKS[@]} -eq 0 ]]; then error "Config missing required: DISKS"; fi
+ # Required-field, disk, and timezone validation runs in main()
+ # via validate_config before this function is reached.
# ZFS-specific validation
if [[ "$FILESYSTEM" == "zfs" ]]; then
@@ -1362,6 +1359,7 @@ main() {
preflight_checks
check_config
validate_filesystem
+ [[ "$UNATTENDED" == true ]] && validate_config
gather_input
filesystem_preflight