From dd7147aee001e9c87ae3b792fec1c7d07942192f Mon Sep 17 00:00:00 2001 From: Thomas Stallinger Date: Mon, 20 Jul 2026 14:51:28 +0200 Subject: [PATCH] fix: make 20_storage.sh self-contained like every other module It called log_info/log_warn/error_exit/list_install_disks without sourcing anything - leftover from before modules were run as standalone subprocesses via run_module() rather than sourced into installer.sh. Never noticed because the pipeline never reached this module in a live run until now. Behavior unchanged: still just lists disks and warns that partitioning is disabled (Phase 1). --- scripts/modules/20_storage.sh | 39 ++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/scripts/modules/20_storage.sh b/scripts/modules/20_storage.sh index ccb4fca..5bdbfdb 100755 --- a/scripts/modules/20_storage.sh +++ b/scripts/modules/20_storage.sh @@ -1,14 +1,37 @@ #!/usr/bin/env bash +set -Eeuo pipefail -log_info "Datenträger werden erkannt..." +SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")" +readonly SCRIPT_NAME -DISKS="$(list_install_disks || true)" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +readonly SCRIPT_DIR -if [[ -z "$DISKS" ]]; then - error_exit "Keine geeigneten Datenträger erkannt." -fi +# shellcheck source=../lib/checks.sh +source "${SCRIPT_DIR}/../lib/checks.sh" -echo "$DISKS" +log() { + printf '[%s] %s\n' "${SCRIPT_NAME}" "$*" +} -log_warn "Phase 1: Datenträger werden nur angezeigt, nicht verändert." -log_warn "Partitionierung ist noch deaktiviert." +fatal() { + printf '[%s] FEHLER: %s\n' "${SCRIPT_NAME}" "$*" >&2 + exit 1 +} + +main() { + log "Datenträger werden erkannt..." + + local disks + disks="$(list_install_disks || true)" + + [[ -n "${disks}" ]] || + fatal "Keine geeigneten Datenträger erkannt." + + printf '%s\n' "${disks}" + + log "Phase 1: Datenträger werden nur angezeigt, nicht verändert." + log "Partitionierung ist noch deaktiviert." +} + +main "$@"