diff options
| -rwxr-xr-x | custom/install-archzfs | 42 | ||||
| -rw-r--r-- | custom/install-archzfs.conf.example | 19 | ||||
| -rw-r--r-- | custom/lib/common.sh | 32 | ||||
| -rw-r--r-- | custom/lib/config.sh | 1 |
4 files changed, 82 insertions, 12 deletions
diff --git a/custom/install-archzfs b/custom/install-archzfs index 6332286..f604f5c 100755 --- a/custom/install-archzfs +++ b/custom/install-archzfs @@ -32,6 +32,9 @@ source "$SCRIPT_DIR/lib/zfs.sh" # Configuration ############################# +# Filesystem selection (zfs or btrfs) +FILESYSTEM="zfs" # Default to ZFS, can be changed interactively or via config + # These will be set interactively HOSTNAME="" TIMEZONE="" @@ -87,15 +90,27 @@ gather_input() { # Validate required config values if [[ -z "$HOSTNAME" ]]; then error "Config missing required: HOSTNAME"; fi if [[ -z "$TIMEZONE" ]]; then error "Config missing required: TIMEZONE"; fi - if [[ "$NO_ENCRYPT" != "yes" && -z "$ZFS_PASSPHRASE" ]]; then error "Config missing required: ZFS_PASSPHRASE"; fi if [[ -z "$ROOT_PASSWORD" ]]; then error "Config missing required: ROOT_PASSWORD"; fi if [[ ${#SELECTED_DISKS[@]} -eq 0 ]]; then error "Config missing required: DISKS"; fi # Set defaults for optional values + [[ -z "$FILESYSTEM" ]] && FILESYSTEM="zfs" || true [[ -z "$LOCALE" ]] && LOCALE="en_US.UTF-8" || true [[ -z "$KEYMAP" ]] && KEYMAP="us" || true [[ -z "$ENABLE_SSH" ]] && ENABLE_SSH="yes" || true + # ZFS-specific validation + if [[ "$FILESYSTEM" == "zfs" ]]; then + if [[ "$NO_ENCRYPT" != "yes" && -z "$ZFS_PASSPHRASE" ]]; then + error "Config missing required: ZFS_PASSPHRASE (or set NO_ENCRYPT=yes)" + fi + fi + + # Btrfs not yet implemented + if [[ "$FILESYSTEM" == "btrfs" ]]; then + error "Btrfs support not yet implemented. Use FILESYSTEM=zfs" + fi + # Determine RAID level if not specified if [[ -z "$RAID_LEVEL" && ${#SELECTED_DISKS[@]} -gt 1 ]]; then RAID_LEVEL="mirror" @@ -103,6 +118,7 @@ gather_input() { fi info "Configuration loaded:" + info " Filesystem: $FILESYSTEM" info " Hostname: $HOSTNAME" info " Timezone: $TIMEZONE" info " Locale: $LOCALE" @@ -117,13 +133,20 @@ gather_input() { echo "" echo "╔═══════════════════════════════════════════════════════════════╗" - echo "║ Arch Linux ZFS Root ║" - echo "║ Configuration and Installation ║" + echo "║ Archangel ║" + echo "║ Arch Linux with Snapshot-Based Recovery ║" echo "╚═══════════════════════════════════════════════════════════════╝" echo "" info "Answer all questions now. Installation will run unattended afterward." echo "" + select_filesystem + + # Check for btrfs (not yet implemented) + if [[ "$FILESYSTEM" == "btrfs" ]]; then + error "Btrfs support not yet implemented. Please select ZFS." + fi + get_hostname get_timezone get_locale @@ -609,6 +632,7 @@ show_summary() { echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "Configuration Summary:" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo " Filesystem: $FILESYSTEM" echo " Hostname: $HOSTNAME" echo " Timezone: $TIMEZONE" echo " Locale: $LOCALE" @@ -621,12 +645,16 @@ show_summary() { echo " RAID Level: ${RAID_LEVEL:-single (no RAID)}" echo " WiFi: ${WIFI_SSID:-Not configured}" echo " SSH: ${ENABLE_SSH:-yes} (root login)" - if [[ "$NO_ENCRYPT" == "yes" ]]; then - echo " ZFS Pool: $POOL_NAME (NOT encrypted)" + if [[ "$FILESYSTEM" == "zfs" ]]; then + if [[ "$NO_ENCRYPT" == "yes" ]]; then + echo " ZFS Pool: $POOL_NAME (NOT encrypted)" + else + echo " ZFS Pool: $POOL_NAME (encrypted)" + fi + echo " Boot: ZFSBootMenu on all disks (redundant)" else - echo " ZFS Pool: $POOL_NAME (encrypted)" + echo " Boot: GRUB + grub-btrfs (snapshot boot)" fi - echo " Boot: ZFSBootMenu on all disks (redundant)" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" diff --git a/custom/install-archzfs.conf.example b/custom/install-archzfs.conf.example index 0060cc0..dacf340 100644 --- a/custom/install-archzfs.conf.example +++ b/custom/install-archzfs.conf.example @@ -1,18 +1,27 @@ -# install-archzfs.conf - Unattended Installation Configuration +# archangel.conf - Unattended Installation Configuration # -# Copy this file to /root/install-archzfs.conf and edit values. -# Or use: install-archzfs --config-file /path/to/your-config.conf +# Copy this file and edit values. +# Usage: archangel --config-file /path/to/your-config.conf # # Required fields: HOSTNAME, TIMEZONE, DISKS, ROOT_PASSWORD -# Plus either ZFS_PASSPHRASE or NO_ENCRYPT=yes +# For ZFS: also need ZFS_PASSPHRASE or NO_ENCRYPT=yes # All other fields have sensible defaults. ############################# +# Filesystem Selection +############################# + +# Filesystem type (optional, default: zfs) +# Options: zfs, btrfs +# Note: btrfs support coming soon +FILESYSTEM=zfs + +############################# # System Configuration ############################# # Hostname for the installed system (required) -HOSTNAME=archzfs +HOSTNAME=archangel # Timezone (required) - Use format: Region/City # Examples: America/Los_Angeles, Europe/London, Asia/Tokyo diff --git a/custom/lib/common.sh b/custom/lib/common.sh index 2f8844e..c271aec 100644 --- a/custom/lib/common.sh +++ b/custom/lib/common.sh @@ -101,6 +101,38 @@ fzf_multi() { } ############################# +# Filesystem Selection +############################# + +# Select filesystem type (ZFS or Btrfs) +# Sets global FILESYSTEM variable +select_filesystem() { + step "Select Filesystem" + + local options=( + "ZFS - Native encryption, best data integrity (recommended)" + "Btrfs - Native Linux, GRUB snapshot boot" + ) + + local selected + selected=$(fzf_select "Filesystem:" "${options[@]}") + + case "$selected" in + ZFS*) + FILESYSTEM="zfs" + info "Selected: ZFS" + ;; + Btrfs*) + FILESYSTEM="btrfs" + info "Selected: Btrfs" + ;; + *) + error "No filesystem selected" + ;; + esac +} + +############################# # Disk Utilities ############################# diff --git a/custom/lib/config.sh b/custom/lib/config.sh index cec3d8c..38811fa 100644 --- a/custom/lib/config.sh +++ b/custom/lib/config.sh @@ -10,6 +10,7 @@ CONFIG_FILE="" UNATTENDED=false # These get populated by config file or interactive prompts +FILESYSTEM="" # "zfs" or "btrfs" HOSTNAME="" TIMEZONE="" LOCALE="" |
