scripts/ (installer.sh, lib/*, modules/00-99) und backends/mint-image/ (inkl. echtem postinstall.sh statt Symlink auf backends/mint/) werden ueber config/includes.chroot/opt/tuxflotte/ ins Image kopiert - bewusst nur die zur Laufzeit benoetigten Dateien, nicht die Build-Host-Werkzeuge (build_customer_iso.sh, build_golden_image.sh, package_golden_image.sh, lib/initrd.sh etc. bleiben aussen vor). 00_preflight.sh und backend_init() (backends/mint-image/backend.sh) verlieren ihre Laufzeit-apt-get-Nachinstallation (jq, parted, dosfstools, e2fsprogs, zstd, btrfs-progs, gettext-base, curl) - alles bereits in Phase 0 vorinstalliert. Werden durch reine Assertions ersetzt, die frueh und klar melden, falls die Paketliste doch mal luecken sollte. backends/mint/postinstall.sh nach backends/mint-image/postinstall.sh als echte Datei verschoben (war Symlink) - noetig, weil backends/mint/ in Phase 4 komplett entfernt wird. Live verifiziert in der enterprise-QEMU-VM: installer.sh von Hand gestartet, Module 00/05/10/12/15/17 liefen sauber durch, inkl. echtem Server-Kontakt zu anode und echter Geraeteregistrierung (Liebherr-Org), Commit-Gate erschien interaktiv wie erwartet, kontrollierter Abbruch ohne jede destruktive Aktion.
85 lines
2.5 KiB
Bash
Executable File
85 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
INSTALLER_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
source "$SCRIPT_DIR/lib/logging.sh"
|
|
source "$SCRIPT_DIR/lib/errors.sh"
|
|
source "$SCRIPT_DIR/lib/utils.sh"
|
|
source "$SCRIPT_DIR/lib/checks.sh"
|
|
|
|
DRY_RUN=false
|
|
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--dry-run) DRY_RUN=true ;;
|
|
*) error_exit "Unbekannter Parameter: $arg" ;;
|
|
esac
|
|
done
|
|
|
|
load_config "$INSTALLER_ROOT/config/installer.conf"
|
|
|
|
log_info "Tuxflotte Installer gestartet"
|
|
log_info "Installer Root: $INSTALLER_ROOT"
|
|
|
|
[[ "$DRY_RUN" == true ]] && log_warn "Dry-Run aktiv"
|
|
|
|
run_module "$SCRIPT_DIR/modules/00_preflight.sh" "always"
|
|
run_module "$SCRIPT_DIR/modules/05_network.sh" "always"
|
|
run_module "$SCRIPT_DIR/modules/10_hardware.sh" "always"
|
|
run_module "$SCRIPT_DIR/modules/12_enrollment_auth.sh" "always"
|
|
run_module "$SCRIPT_DIR/modules/15_server_handshake.sh" "always"
|
|
run_module "$SCRIPT_DIR/modules/17_device_status.sh" "always"
|
|
PROVISIONING_STATE_FILE="/run/tuxflotte/provisioning/state.env"
|
|
|
|
[[ -r "$PROVISIONING_STATE_FILE" ]] ||
|
|
error_exit "Provisionierungszustand fehlt: $PROVISIONING_STATE_FILE"
|
|
|
|
# shellcheck disable=SC1090
|
|
source "$PROVISIONING_STATE_FILE"
|
|
|
|
case "${TUXFLOTTE_PROVISIONING_CONTINUE:-}" in
|
|
true)
|
|
log_info "Provisionierung wird fortgesetzt."
|
|
;;
|
|
false)
|
|
log_info "Provisionierung wurde durch den Benutzer kontrolliert beendet."
|
|
exit 0
|
|
;;
|
|
*)
|
|
error_exit "Ungültiger Provisionierungszustand."
|
|
;;
|
|
esac
|
|
run_module "$SCRIPT_DIR/modules/20_profile_selection.sh" "always"
|
|
run_module "$SCRIPT_DIR/modules/25_installation_confirm.sh" "always"
|
|
|
|
INSTALLATION_STATE_FILE="/run/tuxflotte/installation/state.env"
|
|
|
|
[[ -r "$INSTALLATION_STATE_FILE" ]] ||
|
|
error_exit "Installationsbestätigung fehlt: $INSTALLATION_STATE_FILE"
|
|
|
|
# shellcheck disable=SC1090
|
|
source "$INSTALLATION_STATE_FILE"
|
|
|
|
case "${TUXFLOTTE_INSTALLATION_CONFIRMED:-}" in
|
|
true)
|
|
log_info "Commit Point bestätigt. Installationsphase wird fortgesetzt."
|
|
;;
|
|
false)
|
|
log_info "Provisionierung wurde durch den Benutzer kontrolliert beendet."
|
|
log_info "Es wurden keine destruktiven Installationsaktionen gestartet."
|
|
exit 0
|
|
;;
|
|
*)
|
|
error_exit "Ungültiger Installationsbestätigungszustand."
|
|
;;
|
|
esac
|
|
|
|
run_module "$SCRIPT_DIR/modules/30_runtime_blueprint.sh" "always"
|
|
run_module "$SCRIPT_DIR/modules/40_backend.sh" "always"
|
|
run_module "$SCRIPT_DIR/modules/20_storage.sh" "dry-run-safe"
|
|
run_module "$SCRIPT_DIR/modules/99_finish.sh" "always"
|
|
|
|
log_success "Tuxflotte Installer abgeschlossen"
|