diff --git a/configs/airootfs/root/.automated_script.sh b/configs/airootfs/root/.automated_script.sh index 28666c4..b58f96b 100644 --- a/configs/airootfs/root/.automated_script.sh +++ b/configs/airootfs/root/.automated_script.sh @@ -90,8 +90,45 @@ warm_offline_mirror & warm_pid=$! trap 'kill "$warm_pid" 2>/dev/null' EXIT +# Autoinstall: a drive labeled cidata (the cloud-init NoCloud label, so Proxmox, +# libvirt and Packer all know how to attach one) carrying the configurator's own +# output stands in for the wizard. Copy those files into /root and everything +# downstream runs the ordinary path against ordinary inputs. +# +# The required pair is the same one the orchestrator treats as mandatory; the +# rest are optional there too, so don't be stricter here. Anything less than the +# pair means this isn't an autoinstall drive, and we fall back to the wizard. +load_cidata() { + local device="" label mnt=/run/cidata + + for label in cidata CIDATA; do + [[ -e /dev/disk/by-label/$label ]] && { device=/dev/disk/by-label/$label; break; } + done + [[ -n $device ]] || return 1 + + mkdir -p "$mnt" + mount -o ro "$device" "$mnt" || return 1 + + if [[ -f $mnt/user_configuration.json && -f $mnt/user_credentials.json ]]; then + cp "$mnt"/user_configuration.json "$mnt"/user_credentials.json /root/ + for file in user_full_name.txt user_email_address.txt user_encrypt_installation.txt ssh.json; do + [[ -f $mnt/$file ]] && cp "$mnt/$file" /root/ + done + umount "$mnt" + return 0 + fi + + umount "$mnt" + return 1 +} + cd /root -./configurator +if load_cidata; then + echo "Autoinstall configuration found on cidata drive; skipping the configurator." + export OMARCHY_UI_INTERACTIVE=no +else + ./configurator +fi # The foreground dashboard is now the sole visible install UI owner. It starts # the actual installer as a non-interactive child, logs child output, waits for @@ -107,4 +144,5 @@ rm -f /run/omarchy-install/state.json --creds /root/user_credentials.json \ --full-name-file /root/user_full_name.txt \ --email-file /root/user_email_address.txt \ - --encrypt-file /root/user_encrypt_installation.txt + --encrypt-file /root/user_encrypt_installation.txt \ + --ssh-keys-file /root/ssh.json diff --git a/configs/airootfs/usr/local/bin/omarchy-iso-install b/configs/airootfs/usr/local/bin/omarchy-iso-install index 3b1de13..0380a1b 100755 --- a/configs/airootfs/usr/local/bin/omarchy-iso-install +++ b/configs/airootfs/usr/local/bin/omarchy-iso-install @@ -16,6 +16,7 @@ while [[ $# -gt 0 ]]; do --full-name-file) export OMARCHY_INSTALL_FULL_NAME_FILE="$2"; shift 2 ;; --email-file) export OMARCHY_INSTALL_EMAIL_FILE="$2"; shift 2 ;; --encrypt-file) export OMARCHY_INSTALL_ENCRYPT_FILE="$2"; shift 2 ;; + --ssh-keys-file) export OMARCHY_INSTALL_SSH_KEYS_FILE="$2"; shift 2 ;; *) echo "omarchy-iso-install: unknown arg $1" >&2; exit 2 ;; esac done