diff options
Diffstat (limited to 'archsetup')
| -rwxr-xr-x | archsetup | 49 |
1 files changed, 49 insertions, 0 deletions
@@ -63,6 +63,54 @@ packages_before="/var/log/archsetup-preexisting-package-list.txt" packages_after="/var/log/archsetup-post-install-package-list.txt" archsetup_packages="/var/log/archsetup-installed-packages.txt" +min_disk_space_gb=20 + +### Pre-flight Checks +preflight_checks() { + echo "Running pre-flight checks..." + + # Check disk space (need at least 20GB free on root partition) + available_kb=$(df / | awk 'NR==2 {print $4}') + available_gb=$((available_kb / 1024 / 1024)) + if [ "$available_gb" -lt "$min_disk_space_gb" ]; then + echo "ERROR: Insufficient disk space" + echo " Required: ${min_disk_space_gb}GB" + echo " Available: ${available_gb}GB" + echo " Free up disk space before running archsetup." + exit 1 + fi + echo " [OK] Disk space: ${available_gb}GB available" + + # Check network connectivity + if ! ping -c 1 -W 5 archlinux.org > /dev/null 2>&1; then + echo "ERROR: No network connectivity" + echo " Cannot reach archlinux.org" + echo " Ensure network is configured before running archsetup." + echo " Try: ip link, dhcpcd, or nmtui" + exit 1 + fi + echo " [OK] Network: archlinux.org reachable" + + # Check pacman is available + if ! command -v pacman > /dev/null 2>&1; then + echo "ERROR: pacman not found" + echo " This script requires Arch Linux with pacman installed." + exit 1 + fi + echo " [OK] Package manager: pacman available" + + # Check we're on Arch Linux + if [ ! -f /etc/arch-release ]; then + echo "ERROR: Not running on Arch Linux" + echo " This script is designed for Arch Linux only." + exit 1 + fi + echo " [OK] System: Arch Linux detected" + + echo "Pre-flight checks passed." + echo "" +} + ### Intro intro() { printf "\n\nArchSetup launched @ %s\n" "$(date +'%D %T')"| tee -a "$logfile" @@ -1045,6 +1093,7 @@ outro() { } ### Installation Steps +preflight_checks # verify system requirements before starting intro # take start stats prerequisites # install software required to install software |
