refactor(installer): simplify install.sh to use download helper and remove preset logic
- commit
- 3641305f87249e2f88db2126a6439a5fcd06d4c0
- author
- bnema · · 2025-10-21 06:13 UTC
- parent
- 2e0e21d
- signature
- unsigned
1 file · +16 -72
M install.sh +16 -72
| @@ -38,70 +38,14 @@ fi | |||
| 38 | 38 | ||
| 39 | 39 | # Download installer files if not present (for curl-based installation) | |
| 40 | 40 | if [ ! -d "$ARCHUP_INSTALL" ]; then | |
| 41 | - | echo "=== Downloading ArchUp installer files ===" | |
| 42 | - | mkdir -p "$ARCHUP_INSTALL" | |
| 43 | - | ||
| 44 | - | # Download all required files using curl | |
| 45 | - | GITHUB_RAW="$ARCHUP_RAW_URL" | |
| 46 | - | ||
| 47 | - | # Create directory structure | |
| 48 | - | mkdir -p "$ARCHUP_INSTALL"/{helpers,preflight,partitioning,base,config,boot,repos,post-install,presets} | |
| 49 | - | ||
| 50 | - | echo "Downloading core files..." | |
| 51 | - | curl -sL "$GITHUB_RAW/install/bootstrap.sh" -o "$ARCHUP_INSTALL/bootstrap.sh" | |
| 52 | - | curl -sL "$GITHUB_RAW/logo.txt" -o "$ARCHUP_PATH/logo.txt" | |
| 53 | - | ||
| 54 | - | echo "Downloading helpers..." | |
| 55 | - | for file in all.sh config.sh logging.sh errors.sh presentation.sh chroot.sh cleanup.sh; do | |
| 56 | - | curl -sL "$GITHUB_RAW/install/helpers/$file" -o "$ARCHUP_INSTALL/helpers/$file" | |
| 57 | - | done | |
| 58 | - | ||
| 59 | - | echo "Downloading preflight..." | |
| 60 | - | for file in all.sh guards.sh begin.sh identify.sh detect-environment.sh; do | |
| 61 | - | curl -sL "$GITHUB_RAW/install/preflight/$file" -o "$ARCHUP_INSTALL/preflight/$file" | |
| 62 | - | done | |
| 63 | - | ||
| 64 | - | echo "Downloading partitioning..." | |
| 65 | - | for file in all.sh detect-disk.sh partition.sh format.sh mount.sh; do | |
| 66 | - | curl -sL "$GITHUB_RAW/install/partitioning/$file" -o "$ARCHUP_INSTALL/partitioning/$file" | |
| 67 | - | done | |
| 68 | - | ||
| 69 | - | echo "Downloading base..." | |
| 70 | - | for file in all.sh kernel.sh pacstrap.sh fstab.sh; do | |
| 71 | - | curl -sL "$GITHUB_RAW/install/base/$file" -o "$ARCHUP_INSTALL/base/$file" | |
| 72 | - | done | |
| 73 | - | ||
| 74 | - | echo "Downloading config..." | |
| 75 | - | for file in all.sh system.sh user.sh network.sh; do | |
| 76 | - | curl -sL "$GITHUB_RAW/install/config/$file" -o "$ARCHUP_INSTALL/config/$file" | |
| 77 | - | done | |
| 78 | - | ||
| 79 | - | echo "Downloading boot..." | |
| 80 | - | for file in all.sh limine.sh; do | |
| 81 | - | curl -sL "$GITHUB_RAW/install/boot/$file" -o "$ARCHUP_INSTALL/boot/$file" | |
| 82 | - | done | |
| 83 | - | ||
| 84 | - | echo "Downloading repos..." | |
| 85 | - | for file in all.sh yay.sh chaotic.sh; do | |
| 86 | - | curl -sL "$GITHUB_RAW/install/repos/$file" -o "$ARCHUP_INSTALL/repos/$file" | |
| 87 | - | done | |
| 88 | - | ||
| 89 | - | echo "Downloading post-install..." | |
| 90 | - | for file in all.sh boot-logo.sh snapper.sh verify.sh unmount.sh; do | |
| 91 | - | curl -sL "$GITHUB_RAW/install/post-install/$file" -o "$ARCHUP_INSTALL/post-install/$file" | |
| 92 | - | done | |
| 93 | - | ||
| 94 | - | echo "Downloading post-boot..." | |
| 95 | - | mkdir -p "$ARCHUP_INSTALL/post-boot" | |
| 96 | - | for file in all.sh snapper.sh ssh-keygen.sh archup-first-boot.service; do | |
| 97 | - | curl -sL "$GITHUB_RAW/install/post-boot/$file" -o "$ARCHUP_INSTALL/post-boot/$file" | |
| 98 | - | done | |
| 99 | - | ||
| 100 | - | echo "Downloading presets..." | |
| 101 | - | curl -sL "$GITHUB_RAW/install/presets/barebone.packages" -o "$ARCHUP_INSTALL/presets/barebone.packages" | |
| 102 | - | ||
| 103 | - | echo "[OK] All files downloaded successfully" | |
| 104 | - | echo "" | |
| 41 | + | # Download the download helper first | |
| 42 | + | mkdir -p "$ARCHUP_INSTALL/helpers" | |
| 43 | + | curl -sL "$ARCHUP_RAW_URL/install/helpers/download.sh" -o "$ARCHUP_INSTALL/helpers/download.sh" | |
| 44 | + | chmod +x "$ARCHUP_INSTALL/helpers/download.sh" | |
| 45 | + | ||
| 46 | + | # Run the download script | |
| 47 | + | source "$ARCHUP_INSTALL/helpers/download.sh" | |
| 48 | + | download_archup_files | |
| 105 | 49 | fi | |
| 106 | 50 | ||
| 107 | 51 | # Bootstrap: Install gum and essential dependencies (plain text, no gum usage) | |
| @@ -143,19 +87,19 @@ source "$ARCHUP_INSTALL/boot/all.sh" | |||
| 143 | 87 | # Repository setup (AUR + Chaotic) | |
| 144 | 88 | source "$ARCHUP_INSTALL/repos/all.sh" | |
| 145 | 89 | ||
| 146 | - | # Post-install (boot logo, unmount drives) | |
| 90 | + | # Post-install (boot logo, snapper, unmount drives) | |
| 147 | 91 | source "$ARCHUP_INSTALL/post-install/all.sh" | |
| 148 | 92 | ||
| 149 | - | # ============================================================ | |
| 150 | - | # FUTURE PHASES (TO BE IMPLEMENTED) | |
| 151 | - | # ============================================================ | |
| 152 | - | # Phase 6: Barebone preset testing | |
| 153 | - | # Phase 7: Default preset (GUI) | |
| 154 | - | ||
| 155 | 93 | # Stop logging and cleanup | |
| 156 | 94 | stop_install_log | |
| 157 | 95 | ||
| 158 | - | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "ArchUp installation complete!" | |
| 96 | + | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "ArchUp barebone installation complete!" | |
| 97 | + | echo | |
| 98 | + | ||
| 99 | + | gum style --foreground 6 --padding "0 0 0 $PADDING_LEFT" "Next steps:" | |
| 100 | + | gum style --padding "0 0 0 $PADDING_LEFT" " 1. Reboot the system" | |
| 101 | + | gum style --padding "0 0 0 $PADDING_LEFT" " 2. After login, run: archup wizard" | |
| 102 | + | gum style --padding "0 0 1 $PADDING_LEFT" " 3. Select your compositor and packages" | |
| 159 | 103 | echo | |
| 160 | 104 | ||
| 161 | 105 | CHOICE=$(gum choose --header "What would you like to do?" --header.padding "0 0 0 $PADDING_LEFT" "Reboot" "Close") | |
| @@ -38,70 +38,14 @@ fi | |||||
| 38 | 38 | ||||
| 39 | # Download installer files if not present (for curl-based installation) | 39 | # Download installer files if not present (for curl-based installation) | ||
| 40 | if [ ! -d "$ARCHUP_INSTALL" ]; then | 40 | if [ ! -d "$ARCHUP_INSTALL" ]; then | ||
| 41 | - | echo "=== Downloading ArchUp installer files ===" | 41 | + | # Download the download helper first |
| 42 | - | mkdir -p "$ARCHUP_INSTALL" | 42 | + | mkdir -p "$ARCHUP_INSTALL/helpers" |
| 43 | - | 43 | + | curl -sL "$ARCHUP_RAW_URL/install/helpers/download.sh" -o "$ARCHUP_INSTALL/helpers/download.sh" | |
| 44 | - | # Download all required files using curl | 44 | + | chmod +x "$ARCHUP_INSTALL/helpers/download.sh" |
| 45 | - | GITHUB_RAW="$ARCHUP_RAW_URL" | 45 | + | |
| 46 | - | 46 | + | # Run the download script | |
| 47 | - | # Create directory structure | 47 | + | source "$ARCHUP_INSTALL/helpers/download.sh" |
| 48 | - | mkdir -p "$ARCHUP_INSTALL"/{helpers,preflight,partitioning,base,config,boot,repos,post-install,presets} | 48 | + | download_archup_files |
| 49 | - | ||||
| 50 | - | echo "Downloading core files..." | |||
| 51 | - | curl -sL "$GITHUB_RAW/install/bootstrap.sh" -o "$ARCHUP_INSTALL/bootstrap.sh" | |||
| 52 | - | curl -sL "$GITHUB_RAW/logo.txt" -o "$ARCHUP_PATH/logo.txt" | |||
| 53 | - | ||||
| 54 | - | echo "Downloading helpers..." | |||
| 55 | - | for file in all.sh config.sh logging.sh errors.sh presentation.sh chroot.sh cleanup.sh; do | |||
| 56 | - | curl -sL "$GITHUB_RAW/install/helpers/$file" -o "$ARCHUP_INSTALL/helpers/$file" | |||
| 57 | - | done | |||
| 58 | - | ||||
| 59 | - | echo "Downloading preflight..." | |||
| 60 | - | for file in all.sh guards.sh begin.sh identify.sh detect-environment.sh; do | |||
| 61 | - | curl -sL "$GITHUB_RAW/install/preflight/$file" -o "$ARCHUP_INSTALL/preflight/$file" | |||
| 62 | - | done | |||
| 63 | - | ||||
| 64 | - | echo "Downloading partitioning..." | |||
| 65 | - | for file in all.sh detect-disk.sh partition.sh format.sh mount.sh; do | |||
| 66 | - | curl -sL "$GITHUB_RAW/install/partitioning/$file" -o "$ARCHUP_INSTALL/partitioning/$file" | |||
| 67 | - | done | |||
| 68 | - | ||||
| 69 | - | echo "Downloading base..." | |||
| 70 | - | for file in all.sh kernel.sh pacstrap.sh fstab.sh; do | |||
| 71 | - | curl -sL "$GITHUB_RAW/install/base/$file" -o "$ARCHUP_INSTALL/base/$file" | |||
| 72 | - | done | |||
| 73 | - | ||||
| 74 | - | echo "Downloading config..." | |||
| 75 | - | for file in all.sh system.sh user.sh network.sh; do | |||
| 76 | - | curl -sL "$GITHUB_RAW/install/config/$file" -o "$ARCHUP_INSTALL/config/$file" | |||
| 77 | - | done | |||
| 78 | - | ||||
| 79 | - | echo "Downloading boot..." | |||
| 80 | - | for file in all.sh limine.sh; do | |||
| 81 | - | curl -sL "$GITHUB_RAW/install/boot/$file" -o "$ARCHUP_INSTALL/boot/$file" | |||
| 82 | - | done | |||
| 83 | - | ||||
| 84 | - | echo "Downloading repos..." | |||
| 85 | - | for file in all.sh yay.sh chaotic.sh; do | |||
| 86 | - | curl -sL "$GITHUB_RAW/install/repos/$file" -o "$ARCHUP_INSTALL/repos/$file" | |||
| 87 | - | done | |||
| 88 | - | ||||
| 89 | - | echo "Downloading post-install..." | |||
| 90 | - | for file in all.sh boot-logo.sh snapper.sh verify.sh unmount.sh; do | |||
| 91 | - | curl -sL "$GITHUB_RAW/install/post-install/$file" -o "$ARCHUP_INSTALL/post-install/$file" | |||
| 92 | - | done | |||
| 93 | - | ||||
| 94 | - | echo "Downloading post-boot..." | |||
| 95 | - | mkdir -p "$ARCHUP_INSTALL/post-boot" | |||
| 96 | - | for file in all.sh snapper.sh ssh-keygen.sh archup-first-boot.service; do | |||
| 97 | - | curl -sL "$GITHUB_RAW/install/post-boot/$file" -o "$ARCHUP_INSTALL/post-boot/$file" | |||
| 98 | - | done | |||
| 99 | - | ||||
| 100 | - | echo "Downloading presets..." | |||
| 101 | - | curl -sL "$GITHUB_RAW/install/presets/barebone.packages" -o "$ARCHUP_INSTALL/presets/barebone.packages" | |||
| 102 | - | ||||
| 103 | - | echo "[OK] All files downloaded successfully" | |||
| 104 | - | echo "" | |||
| 105 | fi | 49 | fi | ||
| 106 | 50 | ||||
| 107 | # Bootstrap: Install gum and essential dependencies (plain text, no gum usage) | 51 | # Bootstrap: Install gum and essential dependencies (plain text, no gum usage) | ||
| @@ -143,19 +87,19 @@ source "$ARCHUP_INSTALL/boot/all.sh" | |||||
| 143 | # Repository setup (AUR + Chaotic) | 87 | # Repository setup (AUR + Chaotic) | ||
| 144 | source "$ARCHUP_INSTALL/repos/all.sh" | 88 | source "$ARCHUP_INSTALL/repos/all.sh" | ||
| 145 | 89 | ||||
| 146 | - | # Post-install (boot logo, unmount drives) | 90 | + | # Post-install (boot logo, snapper, unmount drives) |
| 147 | source "$ARCHUP_INSTALL/post-install/all.sh" | 91 | source "$ARCHUP_INSTALL/post-install/all.sh" | ||
| 148 | 92 | ||||
| 149 | - | # ============================================================ | |||
| 150 | - | # FUTURE PHASES (TO BE IMPLEMENTED) | |||
| 151 | - | # ============================================================ | |||
| 152 | - | # Phase 6: Barebone preset testing | |||
| 153 | - | # Phase 7: Default preset (GUI) | |||
| 154 | - | ||||
| 155 | # Stop logging and cleanup | 93 | # Stop logging and cleanup | ||
| 156 | stop_install_log | 94 | stop_install_log | ||
| 157 | 95 | ||||
| 158 | - | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "ArchUp installation complete!" | 96 | + | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "ArchUp barebone installation complete!" |
| 97 | + | echo | |||
| 98 | + | ||||
| 99 | + | gum style --foreground 6 --padding "0 0 0 $PADDING_LEFT" "Next steps:" | |||
| 100 | + | gum style --padding "0 0 0 $PADDING_LEFT" " 1. Reboot the system" | |||
| 101 | + | gum style --padding "0 0 0 $PADDING_LEFT" " 2. After login, run: archup wizard" | |||
| 102 | + | gum style --padding "0 0 1 $PADDING_LEFT" " 3. Select your compositor and packages" | |||
| 159 | echo | 103 | echo | ||
| 160 | 104 | ||||
| 161 | CHOICE=$(gum choose --header "What would you like to do?" --header.padding "0 0 0 $PADDING_LEFT" "Reboot" "Close") | 105 | CHOICE=$(gum choose --header "What would you like to do?" --header.padding "0 0 0 $PADDING_LEFT" "Reboot" "Close") | ||