diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-31 14:46:21 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-31 14:46:21 -0600 |
| commit | d32546a050e08c666ec54cd422bd8a79d66e81c3 (patch) | |
| tree | 41b434e6014ccbaa47b96588e58258e7907a1d8d /scripts | |
| parent | 864e061b817134f9c363410045088721461f46f9 (diff) | |
| download | archangel-d32546a050e08c666ec54cd422bd8a79d66e81c3.tar.gz archangel-d32546a050e08c666ec54cd422bd8a79d66e81c3.zip | |
refactor: rename archzfs to archangel, simplify build-release
- Standardize naming: VM names, hostname, passwords, ISO naming
- Remove USB, Ventoy, and local deployment from build-release
- Add snapper package and Btrfs validation tests to sanity-test
- Update README for dual ZFS/Btrfs architecture
- Delete obsolete SESSION-CONTEXT.md and download-archzfs-iso.sh
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/boot-vm.sh | 2 | ||||
| -rwxr-xr-x | scripts/build-release | 207 | ||||
| -rwxr-xr-x | scripts/full-test.sh | 20 | ||||
| -rwxr-xr-x | scripts/sanity-test.sh | 69 | ||||
| -rwxr-xr-x | scripts/test-install.sh | 8 | ||||
| -rwxr-xr-x | scripts/test-vm.sh | 10 |
6 files changed, 77 insertions, 239 deletions
diff --git a/scripts/boot-vm.sh b/scripts/boot-vm.sh index 82922db..6eb8eea 100755 --- a/scripts/boot-vm.sh +++ b/scripts/boot-vm.sh @@ -6,7 +6,7 @@ # - Otherwise, boot from ISO SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -VM_DISK="$SCRIPT_DIR/../vm/archzfs-test.qcow2" +VM_DISK="$SCRIPT_DIR/../vm/archangel-test.qcow2" if [[ -f "$VM_DISK" ]] && [[ $(stat -c%s "$VM_DISK") -gt 200000 ]]; then # Disk exists and is larger than ~200KB (has been written to) diff --git a/scripts/build-release b/scripts/build-release index e02381a..ef0c96f 100755 --- a/scripts/build-release +++ b/scripts/build-release @@ -1,5 +1,5 @@ #!/bin/bash -# build-release - Build and distribute the archzfs ISO +# build-release - Build and distribute the archangel ISO # # Usage: # ./scripts/build-release # Full build, sanity test, and distribute @@ -8,10 +8,7 @@ # ./scripts/build-release --skip-test # Skip all testing # # Distribution targets: -# - ~/downloads/isos (always) # - truenas.local:/mnt/vault/isos (if reachable) -# - USB drive with ARCHZFS label (if present, writes via dd) -# - Ventoy USB drive (if detected, copies ISO file) set -e @@ -28,7 +25,6 @@ else fi # Distribution targets -LOCAL_ISO_DIR="$REAL_HOME/downloads/isos" TRUENAS_HOST="truenas.local" TRUENAS_PATH="/mnt/vault/isos" @@ -48,21 +44,18 @@ step() { echo -e "\n${CYAN}=== $1 ===${NC}\n"; } SKIP_BUILD=false SKIP_TEST=false FULL_TEST=false -AUTO_CONFIRM=false while [[ $# -gt 0 ]]; do case $1 in --skip-build) SKIP_BUILD=true; shift ;; --skip-test) SKIP_TEST=true; shift ;; --full-test) FULL_TEST=true; shift ;; - --yes|-y) AUTO_CONFIRM=true; shift ;; -h|--help) - echo "Usage: $0 [--skip-build] [--skip-test] [--full-test] [--yes]" + echo "Usage: $0 [--skip-build] [--skip-test] [--full-test]" echo "" echo "Options:" echo " --skip-build Skip ISO build, distribute existing ISO" echo " --skip-test Skip QEMU sanity test" echo " --full-test Run comprehensive install tests (single, mirror, raidz1)" - echo " --yes, -y Auto-confirm dd to ARCHZFS drive (no prompt)" exit 0 ;; *) error "Unknown option: $1" ;; @@ -75,7 +68,7 @@ TRUENAS_SUCCESS=false # Check root for build check_root() { if [[ $EUID -ne 0 ]]; then - error "This script must be run as root (for build and dd operations)" + error "This script must be run as root (for build operations)" fi } @@ -122,94 +115,6 @@ full_test() { info "All installation tests passed!" } -# Find ARCHZFS labeled USB drive -find_archzfs_drive() { - ARCHZFS_DEV=$(blkid -L ARCHZFS 2>/dev/null | head -1) - if [[ -n "$ARCHZFS_DEV" ]]; then - # Get the parent device (e.g., /dev/sda from /dev/sda1) - ARCHZFS_DISK=$(lsblk -no PKNAME "$ARCHZFS_DEV" 2>/dev/null | head -1) - if [[ -n "$ARCHZFS_DISK" ]]; then - ARCHZFS_DISK="/dev/$ARCHZFS_DISK" - # Note: Don't check for removable - Framework expansion cards - # show as internal drives but are actually hot-swappable - info "Found ARCHZFS drive: $ARCHZFS_DISK" - return 0 - fi - fi - ARCHZFS_DISK="" - return 1 -} - -# Find Ventoy USB drive -find_ventoy_drive() { - VENTOY_PART="" - VENTOY_MOUNT="" - - # Method 1: Look for partition labeled "Ventoy" - local ventoy_by_label=$(blkid -L Ventoy 2>/dev/null | head -1) - if [[ -n "$ventoy_by_label" ]]; then - VENTOY_PART="$ventoy_by_label" - info "Found Ventoy drive by label: $VENTOY_PART" - return 0 - fi - - # Method 2: Check mounted or mountable partitions for ventoy/ directory - # Look for removable drives with exfat/ntfs - while read -r dev fstype rm; do - [[ "$rm" != "1" ]] && continue # Skip non-removable - [[ ! "$fstype" =~ ^(exfat|ntfs|vfat)$ ]] && continue # Skip wrong fs types - - local mount_point=$(lsblk -no MOUNTPOINT "/dev/$dev" 2>/dev/null) - local needs_unmount=false - - if [[ -z "$mount_point" ]]; then - # Try mounting temporarily - mount_point=$(mktemp -d) - if mount -o ro "/dev/$dev" "$mount_point" 2>/dev/null; then - needs_unmount=true - else - rmdir "$mount_point" - continue - fi - fi - - # Check for ventoy directory - if [[ -d "$mount_point/ventoy" ]] || [[ -f "$mount_point/ventoy/ventoy.json" ]]; then - VENTOY_PART="/dev/$dev" - info "Found Ventoy drive by content: $VENTOY_PART" - if $needs_unmount; then - umount "$mount_point" - rmdir "$mount_point" - fi - return 0 - fi - - if $needs_unmount; then - umount "$mount_point" - rmdir "$mount_point" - fi - done < <(lsblk -rno NAME,FSTYPE,RM 2>/dev/null | grep -v "^loop") - - return 1 -} - -# Distribute to local directory -distribute_local() { - step "Distributing to Local Directory" - mkdir -p "$LOCAL_ISO_DIR" - - # Remove old archzfs ISOs - local old_isos=$(ls "$LOCAL_ISO_DIR"/archzfs-*.iso 2>/dev/null || true) - if [[ -n "$old_isos" ]]; then - info "Removing old ISOs..." - rm -f "$LOCAL_ISO_DIR"/archzfs-*.iso - fi - - info "Copying to $LOCAL_ISO_DIR/" - cp "$ISO_FILE" "$LOCAL_ISO_DIR/" - info "Done: $LOCAL_ISO_DIR/$ISO_NAME" -} - # Distribute to TrueNAS distribute_truenas() { step "Distributing to TrueNAS" @@ -222,18 +127,12 @@ distribute_truenas() { info "TrueNAS is reachable" - # Run SSH/SCP as the real user (not root) to use their SSH keys - local ssh_cmd="ssh" + # Run SCP as the real user (not root) to use their SSH keys local scp_cmd="scp" if [[ -n "$SUDO_USER" ]]; then - ssh_cmd="sudo -u $SUDO_USER ssh" scp_cmd="sudo -u $SUDO_USER scp" fi - # Remove old ISOs and copy new one - info "Removing old ISOs from TrueNAS..." - $ssh_cmd "cjennings@$TRUENAS_HOST" "rm -f $TRUENAS_PATH/archzfs-*.iso" 2>/dev/null || true - info "Copying to $TRUENAS_HOST:$TRUENAS_PATH/" if $scp_cmd "$ISO_FILE" "cjennings@$TRUENAS_HOST:$TRUENAS_PATH/"; then info "Done: $TRUENAS_HOST:$TRUENAS_PATH/$ISO_NAME" @@ -244,106 +143,15 @@ distribute_truenas() { fi } -# Write to ARCHZFS USB drive -distribute_archzfs_usb() { - step "Writing to ARCHZFS USB Drive" - - if ! find_archzfs_drive; then - warn "No ARCHZFS USB drive found, skipping" - return 0 - fi - - # Confirm before writing (unless --yes flag) - echo "" - warn "About to write ISO to $ARCHZFS_DISK" - lsblk "$ARCHZFS_DISK" - echo "" - - if ! $AUTO_CONFIRM; then - warn "This will ERASE ALL DATA on the drive!" - read -p "Type 'yes' to confirm: " confirm - if [[ "$confirm" != "yes" ]]; then - warn "Skipping USB write" - return 0 - fi - else - info "Auto-confirmed (--yes flag)" - fi - - # Unmount any mounted partitions - for part in $(lsblk -rno NAME "$ARCHZFS_DISK" | tail -n +2); do - umount "/dev/$part" 2>/dev/null || true - done - - info "Writing ISO to $ARCHZFS_DISK..." - dd if="$ISO_FILE" of="$ARCHZFS_DISK" bs=4M status=progress oflag=sync - sync - info "Done writing to $ARCHZFS_DISK" -} - -# Copy to Ventoy USB drive -distribute_ventoy() { - step "Copying to Ventoy USB Drive" - - if ! find_ventoy_drive; then - warn "No Ventoy USB drive found, skipping" - return 0 - fi - - # Mount if needed - local mount_point=$(lsblk -no MOUNTPOINT "$VENTOY_PART" 2>/dev/null) - local needs_unmount=false - - if [[ -z "$mount_point" ]]; then - mount_point=$(mktemp -d) - info "Mounting $VENTOY_PART to $mount_point" - mount "$VENTOY_PART" "$mount_point" - needs_unmount=true - fi - - # Remove old archzfs ISOs - local old_isos=$(ls "$mount_point"/archzfs-*.iso 2>/dev/null || true) - if [[ -n "$old_isos" ]]; then - info "Removing old ISOs from Ventoy..." - rm -f "$mount_point"/archzfs-*.iso - fi - - info "Copying ISO to Ventoy drive..." - cp "$ISO_FILE" "$mount_point/" - sync - info "Done: $mount_point/$ISO_NAME" - - if $needs_unmount; then - info "Unmounting Ventoy drive..." - umount "$mount_point" - rmdir "$mount_point" - fi -} - # Summary show_summary() { step "Distribution Complete" echo "ISO: $ISO_NAME" echo "" - echo "Distributed to:" - echo " ✓ $LOCAL_ISO_DIR/" - if $TRUENAS_SUCCESS; then - echo " ✓ $TRUENAS_HOST:$TRUENAS_PATH/" - else - echo " ✗ $TRUENAS_HOST (failed or skipped)" - fi - - if [[ -n "$ARCHZFS_DISK" ]]; then - echo " ✓ $ARCHZFS_DISK (USB boot drive)" - else - echo " - ARCHZFS USB drive (not found)" - fi - - if [[ -n "$VENTOY_PART" ]]; then - echo " ✓ $VENTOY_PART (Ventoy)" + echo "Distributed to: $TRUENAS_HOST:$TRUENAS_PATH/" else - echo " - Ventoy drive (not found)" + echo "TrueNAS not reachable - ISO only in out/" fi } @@ -366,10 +174,7 @@ main() { step "Skipping Tests" fi - distribute_local distribute_truenas - distribute_archzfs_usb - distribute_ventoy show_summary } diff --git a/scripts/full-test.sh b/scripts/full-test.sh index a1e1c3a..9276bab 100755 --- a/scripts/full-test.sh +++ b/scripts/full-test.sh @@ -1,5 +1,5 @@ #!/bin/bash -# full-test.sh - Comprehensive installation testing for archzfs ISO +# full-test.sh - Comprehensive installation testing for archangel ISO # # Runs automated installation tests for all disk configurations: # - Single disk @@ -8,7 +8,7 @@ # # Each test: # 1. Boots ISO in headless QEMU -# 2. Runs unattended install-archzfs +# 2. Runs unattended archangel # 3. Reboots into installed system # 4. Verifies ZFS pool is healthy # @@ -40,7 +40,7 @@ OVMF_VARS_ORIG="/usr/share/edk2/x64/OVMF_VARS.4m.fd" # SSH settings SSH_PORT=2224 # Different port to avoid conflicts SSH_USER="root" -SSH_PASS_LIVE="archzfs" # Live ISO password +SSH_PASS_LIVE="archangel" # Live ISO password SSH_PASS_INSTALLED="testroot123" # Installed system password (from config) SSH_PASS="$SSH_PASS_LIVE" # Current password (switches after install) SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -o ConnectTimeout=5" @@ -90,7 +90,7 @@ while [[ $# -gt 0 ]]; do -h|--help) echo "Usage: $0 [--quick] [--verbose]" echo "" - echo "Comprehensive installation testing for archzfs ISO." + echo "Comprehensive installation testing for archangel ISO." echo "" echo "Options:" echo " --quick, -q Run single-disk test only (faster)" @@ -167,7 +167,7 @@ start_vm_iso() { done qemu-system-x86_64 \ - -name "archzfs-fulltest" \ + -name "archangel-fulltest" \ -machine q35,accel=kvm \ -cpu host \ -smp "$VM_CPUS" \ @@ -207,7 +207,7 @@ start_vm_disk() { done qemu-system-x86_64 \ - -name "archzfs-fulltest" \ + -name "archangel-fulltest" \ -machine q35,accel=kvm \ -cpu host \ -smp "$VM_CPUS" \ @@ -340,11 +340,11 @@ $config CONF" # Run installation - info "Running install-archzfs (this takes several minutes)..." + info "Running archangel (this takes several minutes)..." local install_start=$(date +%s) # Run install in background and monitor - ssh_cmd "nohup install-archzfs --config-file /tmp/install.conf > /tmp/install.log 2>&1 &" + ssh_cmd "nohup archangel --config-file /tmp/install.conf > /tmp/install.log 2>&1 &" # Wait for installation to complete local elapsed=0 @@ -354,7 +354,7 @@ CONF" ((elapsed += check_interval)) # Check if install process is still running - if ! ssh_cmd "pgrep -f 'install-archzfs' > /dev/null" 2>/dev/null; then + if ! ssh_cmd "pgrep -f 'archangel' > /dev/null" 2>/dev/null; then # Process finished - check result by looking for success indicators local exit_check=$(ssh_cmd "tail -30 /tmp/install.log" 2>/dev/null) # Check for various success indicators @@ -541,7 +541,7 @@ print_summary() { # Main main() { - banner "ARCHZFS FULL INSTALLATION TEST" + banner "ARCHANGEL FULL INSTALLATION TEST" check_deps find_iso diff --git a/scripts/sanity-test.sh b/scripts/sanity-test.sh index eeb4d29..9248da1 100755 --- a/scripts/sanity-test.sh +++ b/scripts/sanity-test.sh @@ -1,5 +1,5 @@ #!/bin/bash -# sanity-test.sh - Automated sanity test for archzfs ISO +# sanity-test.sh - Automated sanity test for archangel ISO # # Boots the ISO in a headless QEMU VM, waits for SSH, runs verification # commands, and reports pass/fail. Fully automated - no human input required. @@ -22,7 +22,7 @@ VM_DISK="$VM_DIR/sanity-test.qcow2" VM_DISK_SIZE="10G" VM_RAM="2048" VM_CPUS="2" -VM_NAME="archzfs-sanity" +VM_NAME="archangel-sanity" # UEFI firmware OVMF_CODE="/usr/share/edk2/x64/OVMF_CODE.4m.fd" @@ -32,7 +32,7 @@ OVMF_VARS="$VM_DIR/sanity-test-OVMF_VARS.fd" # SSH settings SSH_PORT=2223 # Different port to avoid conflicts with test-vm.sh SSH_USER="root" -SSH_PASS="archzfs" +SSH_PASS="archangel" SSH_TIMEOUT=180 # Max seconds to wait for SSH SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -o ConnectTimeout=5" @@ -62,7 +62,7 @@ while [[ $# -gt 0 ]]; do -h|--help) echo "Usage: $0 [--verbose]" echo "" - echo "Automated sanity test for archzfs ISO." + echo "Automated sanity test for archangel ISO." echo "Boots ISO in headless QEMU, verifies via SSH, reports results." exit 0 ;; @@ -232,8 +232,8 @@ run_sanity_tests() { "zfs-" # Test 4: Custom scripts present - run_test "install-archzfs script present" \ - "test -x /usr/local/bin/install-archzfs && echo 'exists'" \ + run_test "archangel script present" \ + "test -x /usr/local/bin/archangel && echo 'exists'" \ "exists" run_test "zfsrollback script present" \ @@ -244,14 +244,6 @@ run_sanity_tests() { "test -x /usr/local/bin/zfssnapshot && echo 'exists'" \ "exists" - run_test "grub-zfs-snap script present" \ - "test -x /usr/local/bin/grub-zfs-snap && echo 'exists'" \ - "exists" - - run_test "zfs-snap-prune script present" \ - "test -x /usr/local/bin/zfs-snap-prune && echo 'exists'" \ - "exists" - # Test 5: fzf installed (required by zfsrollback) run_test "fzf installed" \ "command -v fzf && echo 'found'" \ @@ -287,10 +279,10 @@ run_sanity_tests() { "grep -q 'mdns' /etc/nsswitch.conf && echo 'configured'" \ "configured" - # Test 9: Hostname set to archzfs - run_test "Hostname is archzfs" \ + # Test 9: Hostname set to archangel + run_test "Hostname is archangel" \ "cat /etc/hostname" \ - "archzfs" + "archangel" # Test 10: Kernel version (LTS) run_test "Running LTS kernel" \ @@ -302,6 +294,47 @@ run_sanity_tests() { "test -d /code/archsetup && echo 'exists'" \ "exists" + # Test 11: Btrfs tools installed (dual filesystem support) + run_test "Btrfs tools installed" \ + "command -v btrfs && echo 'found'" \ + "found" + + run_test "mkfs.btrfs available" \ + "command -v mkfs.btrfs && echo 'found'" \ + "found" + + # Test 12: Snapper installed (Btrfs snapshot management) + run_test "Snapper installed" \ + "command -v snapper && echo 'found'" \ + "found" + + # Test 13: archangel installer components + run_test "archangel script executable" \ + "file /usr/local/bin/archangel | grep -q 'script' && echo 'executable'" \ + "executable" + + run_test "archangel lib directory present" \ + "test -d /usr/local/bin/lib && echo 'exists'" \ + "exists" + + run_test "archangel lib/common.sh present" \ + "test -f /usr/local/bin/lib/common.sh && echo 'exists'" \ + "exists" + + run_test "archangel config example present" \ + "test -f /root/archangel.conf.example && echo 'exists'" \ + "exists" + + # Test 14: GRUB installed (for Btrfs bootloader) + run_test "GRUB installed" \ + "command -v grub-install && echo 'found'" \ + "found" + + # Test 15: Cryptsetup for LUKS (Btrfs encryption) + run_test "Cryptsetup installed" \ + "command -v cryptsetup && echo 'found'" \ + "found" + echo "" } @@ -328,7 +361,7 @@ print_summary() { main() { echo "" echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" - echo -e "${CYAN} ARCHZFS ISO SANITY TEST${NC}" + echo -e "${CYAN} ARCHANGEL ISO SANITY TEST${NC}" echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" echo "" diff --git a/scripts/test-install.sh b/scripts/test-install.sh index c4f859f..f0046bb 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -1,5 +1,5 @@ #!/bin/bash -# test-install.sh - Automated installation testing for archzfs +# test-install.sh - Automated installation testing for archangel # # Runs unattended installs in VMs using test config files. # Verifies installation success via SSH (when enabled) or console. @@ -22,7 +22,7 @@ VM_RAM="4096" VM_CPUS="4" VM_DISK_SIZE="20G" export SSH_PORT="2222" -export SSH_PASSWORD="archzfs" +export SSH_PASSWORD="archangel" SERIAL_LOG="$LOG_DIR/serial.log" # Timeouts (seconds) @@ -149,7 +149,7 @@ start_vm() { # Start VM with serial console logging qemu-system-x86_64 \ - -name "archzfs-test-$test_name" \ + -name "archangel-test-$test_name" \ -machine type=q35,accel=kvm \ -cpu host \ -m "$VM_RAM" \ @@ -183,7 +183,7 @@ start_vm_from_disk() { # Start VM without ISO, boot from disk qemu-system-x86_64 \ - -name "archzfs-test-$test_name" \ + -name "archangel-test-$test_name" \ -machine type=q35,accel=kvm \ -cpu host \ -m "$VM_RAM" \ diff --git a/scripts/test-vm.sh b/scripts/test-vm.sh index 4c56570..f2a4a00 100755 --- a/scripts/test-vm.sh +++ b/scripts/test-vm.sh @@ -1,5 +1,5 @@ #!/bin/bash -# test-vm.sh - Test the archzfs ISO in a QEMU virtual machine +# test-vm.sh - Test the archangel ISO in a QEMU virtual machine # # Usage: # ./test-vm.sh # Create new VM and boot ISO (single disk) @@ -13,7 +13,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" # VM Configuration -VM_NAME="archzfs-test" +VM_NAME="archangel-test" VM_DIR="$PROJECT_DIR/vm" VM_DISK="$VM_DIR/$VM_NAME.qcow2" VM_DISK2="$VM_DIR/$VM_NAME-disk2.qcow2" @@ -139,8 +139,8 @@ boot_iso() { echo " - Press Ctrl+Alt+G to release mouse grab" echo " - Press Ctrl+Alt+F to toggle fullscreen" echo " - Serial console output appears in this terminal" - echo " - SSH: ssh -p 2222 root@localhost (password: archzfs)" - echo " - Run 'install-archzfs' to start installation" + echo " - SSH: ssh -p 2222 root@localhost (password: archangel)" + echo " - Run 'archangel' to start installation" echo " - Monitor socket: $MONITOR_SOCKET" echo "" @@ -258,7 +258,7 @@ show_help() { echo " CPUs: $VM_CPUS" echo "" echo "SSH into running VM:" - echo " ssh -p 2222 root@localhost (password: archzfs)" + echo " ssh -p 2222 root@localhost (password: archangel)" } # Main |
