diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-23 18:02:52 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-23 18:02:52 -0600 |
| commit | c74f656694e084fdf748f7ac86aa4b2361cbe1ed (patch) | |
| tree | c015ff6752ee648925a690f04782eff3e8be6b2a /custom/install-archzfs | |
| parent | 8e4b16e481db5236d67e7a10e206cccd0e3285cd (diff) | |
| download | archangel-c74f656694e084fdf748f7ac86aa4b2361cbe1ed.tar.gz archangel-c74f656694e084fdf748f7ac86aa4b2361cbe1ed.zip | |
Fix set -e compatibility in lib functions
- Replace [[ ]] && error pattern with if/then/fi
- Pattern causes exit when condition is false with set -e
- Fixed in: common.sh, config.sh, disk.sh, install-archzfs
Discovered during VM testing: the && short-circuit returns exit
code 1 when condition is false, triggering set -e to abort.
Diffstat (limited to 'custom/install-archzfs')
| -rwxr-xr-x | custom/install-archzfs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/custom/install-archzfs b/custom/install-archzfs index 6f098cc..6332286 100755 --- a/custom/install-archzfs +++ b/custom/install-archzfs @@ -85,16 +85,16 @@ preflight_checks() { gather_input() { if [[ "$UNATTENDED" == true ]]; then # Validate required config values - [[ -z "$HOSTNAME" ]] && error "Config missing required: HOSTNAME" - [[ -z "$TIMEZONE" ]] && error "Config missing required: TIMEZONE" - [[ "$NO_ENCRYPT" != "yes" && -z "$ZFS_PASSPHRASE" ]] && error "Config missing required: ZFS_PASSPHRASE" - [[ -z "$ROOT_PASSWORD" ]] && error "Config missing required: ROOT_PASSWORD" - [[ ${#SELECTED_DISKS[@]} -eq 0 ]] && error "Config missing required: DISKS" + if [[ -z "$HOSTNAME" ]]; then error "Config missing required: HOSTNAME"; fi + if [[ -z "$TIMEZONE" ]]; then error "Config missing required: TIMEZONE"; fi + if [[ "$NO_ENCRYPT" != "yes" && -z "$ZFS_PASSPHRASE" ]]; then error "Config missing required: ZFS_PASSPHRASE"; 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 # Set defaults for optional values - [[ -z "$LOCALE" ]] && LOCALE="en_US.UTF-8" - [[ -z "$KEYMAP" ]] && KEYMAP="us" - [[ -z "$ENABLE_SSH" ]] && ENABLE_SSH="yes" + [[ -z "$LOCALE" ]] && LOCALE="en_US.UTF-8" || true + [[ -z "$KEYMAP" ]] && KEYMAP="us" || true + [[ -z "$ENABLE_SSH" ]] && ENABLE_SSH="yes" || true # Determine RAID level if not specified if [[ -z "$RAID_LEVEL" && ${#SELECTED_DISKS[@]} -gt 1 ]]; then |
