From 74fb6ab9cc2b8d38ea75a6b52b67ec34281a2338 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Fri, 23 Jan 2026 15:45:55 -0600 Subject: Phase 1.1: Create lib/ directory structure for archangel refactor - Add custom/lib/common.sh: output, validation, fzf prompts, disk utils - Add custom/lib/config.sh: argument parsing, config loading, validation - Add custom/lib/disk.sh: partitioning, EFI management, disk selection - Add custom/lib/zfs.sh: pool, datasets, ZFSBootMenu, services, hooks - Update install-archzfs to source libs - Remove duplicated output/config functions from main script Prepares codebase for btrfs filesystem support (Phase 2). --- custom/lib/config.sh | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 custom/lib/config.sh (limited to 'custom/lib/config.sh') diff --git a/custom/lib/config.sh b/custom/lib/config.sh new file mode 100644 index 0000000..82f5d77 --- /dev/null +++ b/custom/lib/config.sh @@ -0,0 +1,127 @@ +#!/usr/bin/env bash +# config.sh - Configuration and argument handling for archangel installer +# Source this file after common.sh + +############################# +# Global Config Variables +############################# + +CONFIG_FILE="" +UNATTENDED=false + +# These get populated by config file or interactive prompts +HOSTNAME="" +TIMEZONE="" +LOCALE="" +KEYMAP="" +SELECTED_DISKS=() +RAID_LEVEL="" +WIFI_SSID="" +WIFI_PASSWORD="" +ENCRYPTION_ENABLED=false +ZFS_PASSPHRASE="" +ROOT_PASSWORD="" +SSH_ENABLED=false +SSH_KEY="" + +############################# +# Argument Parsing +############################# + +parse_args() { + while [[ $# -gt 0 ]]; do + case "$1" in + --config-file) + if [[ -n "$2" && ! "$2" =~ ^- ]]; then + CONFIG_FILE="$2" + shift 2 + else + error "--config-file requires a path argument" + fi + ;; + --help|-h) + show_usage + exit 0 + ;; + *) + error "Unknown option: $1 (use --help for usage)" + ;; + esac + done +} + +show_usage() { + cat <