101 lines
2.6 KiB
Bash
Executable File
101 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
|
|
# shellcheck source=install/lib/common.sh
|
|
source "${SCRIPT_DIR}/lib/common.sh"
|
|
# shellcheck source=install/lib/logging.sh
|
|
source "${SCRIPT_DIR}/lib/logging.sh"
|
|
# shellcheck source=install/lib/packages.sh
|
|
source "${SCRIPT_DIR}/lib/packages.sh"
|
|
# shellcheck source=install/lib/services.sh
|
|
source "${SCRIPT_DIR}/lib/services.sh"
|
|
# shellcheck source=install/lib/files.sh
|
|
source "${SCRIPT_DIR}/lib/files.sh"
|
|
# shellcheck source=install/lib/validation.sh
|
|
source "${SCRIPT_DIR}/lib/validation.sh"
|
|
|
|
atlas_set_script_name "bootstrap.sh"
|
|
atlas_install_error_trap
|
|
atlas_install_cleanup_trap
|
|
|
|
RUN_VALIDATION=0
|
|
INIT_LOG=0
|
|
ATLAS_INSTALL_LOG_DIR="/var/log/atlas/install"
|
|
|
|
usage() {
|
|
cat <<'USAGE'
|
|
Usage: install/bootstrap.sh [options]
|
|
|
|
Phase 2A bootstrap scaffold. This command does not install packages,
|
|
alter services, change firewall rules, or modify system configuration.
|
|
|
|
Options:
|
|
--help Show this help text.
|
|
--version Show script/framework version.
|
|
--dry-run Show intended actions without making changes.
|
|
--verbose Print additional diagnostic output.
|
|
--log Initialise a timestamped installer log file.
|
|
--validate-host Run the read-only host validation script.
|
|
|
|
USAGE
|
|
}
|
|
|
|
while [[ "$#" -gt 0 ]]; do
|
|
case "$1" in
|
|
--help)
|
|
usage
|
|
exit "${ATLAS_EXIT_OK}"
|
|
;;
|
|
--version)
|
|
atlas_print_version
|
|
exit "${ATLAS_EXIT_OK}"
|
|
;;
|
|
--dry-run)
|
|
atlas_enable_dry_run
|
|
;;
|
|
--verbose)
|
|
atlas_enable_verbose
|
|
;;
|
|
--log)
|
|
INIT_LOG=1
|
|
;;
|
|
--validate-host)
|
|
RUN_VALIDATION=1
|
|
;;
|
|
*)
|
|
atlas_usage_error "Unknown option: $1"
|
|
exit "${ATLAS_EXIT_USAGE}"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [[ "$INIT_LOG" == "1" ]]; then
|
|
atlas_init_log_file "$ATLAS_INSTALL_LOG_DIR" "bootstrap"
|
|
fi
|
|
|
|
atlas_log_info "Atlas bootstrap scaffold"
|
|
atlas_log_info "Repository root: ${REPO_ROOT}"
|
|
atlas_log_info "Dry-run mode: ${ATLAS_DRY_RUN}"
|
|
|
|
atlas_require_command bash
|
|
atlas_require_command git
|
|
atlas_require_command systemctl
|
|
atlas_require_command findmnt
|
|
atlas_require_command df
|
|
|
|
atlas_log_info "Planned future phase directory: ${SCRIPT_DIR}/phases"
|
|
atlas_log_info "No component installers are invoked during Phase 2A"
|
|
|
|
if [[ "$RUN_VALIDATION" == "1" ]]; then
|
|
atlas_log_info "Running read-only host validation"
|
|
"${REPO_ROOT}/scripts/system/validate-host.sh"
|
|
else
|
|
atlas_log_info "Host validation not requested; use --validate-host to run it"
|
|
fi
|
|
|
|
atlas_log_ok "Bootstrap scaffold completed"
|