41 lines
871 B
Bash
41 lines
871 B
Bash
#!/usr/bin/env bash
|
|
|
|
load_config() {
|
|
local config_file="$1"
|
|
|
|
if [[ -f "$config_file" ]]; then
|
|
# shellcheck disable=SC1090
|
|
source "$config_file"
|
|
log_info "Konfiguration geladen: $config_file"
|
|
else
|
|
log_warn "Keine Konfiguration gefunden: $config_file"
|
|
fi
|
|
}
|
|
|
|
run_module() {
|
|
local module="$1"
|
|
local mode="${2:-normal}"
|
|
|
|
[[ -f "$module" ]] || error_exit "Modul nicht gefunden: $module"
|
|
|
|
log_info "Starte Modul: $(basename "$module")"
|
|
|
|
if [[ "${DRY_RUN:-false}" == true && "$mode" != "always" ]]; then
|
|
log_warn "Dry-Run: Modul übersprungen: $module"
|
|
return 0
|
|
fi
|
|
|
|
# shellcheck disable=SC1090
|
|
source "$module"
|
|
|
|
log_success "Modul abgeschlossen: $(basename "$module")"
|
|
}
|
|
|
|
require_root() {
|
|
[[ "$EUID" -eq 0 ]] || error_exit "Installer muss als root ausgeführt werden."
|
|
}
|
|
|
|
command_exists() {
|
|
command -v "$1" >/dev/null 2>&1
|
|
}
|