refactor(repos): consolidate aur helpers into single aur.sh script
- commit
- f3a9363ade221fe264292140514a2f3142f2dce4
- author
- bnema · · 2025-10-21 06:14 UTC
- parent
- 388e7ef
- signature
- unsigned
4 files · +87 -120
M install/repos/all.sh +2 -22
| @@ -3,27 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | stop_log_output # Stop for interactive prompts | |
| 5 | 5 | ||
| 6 | - | # AUR Support prompt | |
| 7 | - | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "AUR Support" | |
| 8 | - | echo | |
| 6 | + | source "$ARCHUP_INSTALL/repos/chaotic.sh" # Interactive (gum confirm) - MUST be before AUR | |
| 7 | + | source "$ARCHUP_INSTALL/repos/aur.sh" # Interactive (gum confirm + choose) | |
| 9 | 8 | ||
| 10 | - | if gum confirm "Enable AUR support?" --padding "0 0 1 $PADDING_LEFT"; then | |
| 11 | - | export ARCHUP_AUR="enabled" | |
| 12 | - | ||
| 13 | - | # Choose AUR helper | |
| 14 | - | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Choose AUR Helper" | |
| 15 | - | AUR_HELPER=$(gum choose --cursor.foreground 6 --padding "0 0 1 $PADDING_LEFT" "paru" "yay") | |
| 16 | - | ||
| 17 | - | if [ "$AUR_HELPER" = "paru" ]; then | |
| 18 | - | source "$ARCHUP_INSTALL/repos/paru.sh" | |
| 19 | - | else | |
| 20 | - | source "$ARCHUP_INSTALL/repos/yay.sh" | |
| 21 | - | fi | |
| 22 | - | else | |
| 23 | - | gum style --foreground 3 --padding "0 0 1 $PADDING_LEFT" "[SKIP] Skipping AUR support" | |
| 24 | - | echo "AUR: disabled" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 25 | - | export ARCHUP_AUR="disabled" | |
| 26 | - | fi | |
| 27 | - | ||
| 28 | - | source "$ARCHUP_INSTALL/repos/chaotic.sh" # Interactive (gum confirm) | |
| 29 | 9 | start_log_output # Resume (will be stopped by stop_install_log) | |
| @@ -3,27 +3,7 @@ | |||||
| 3 | 3 | ||||
| 4 | stop_log_output # Stop for interactive prompts | 4 | stop_log_output # Stop for interactive prompts | ||
| 5 | 5 | ||||
| 6 | - | # AUR Support prompt | 6 | + | source "$ARCHUP_INSTALL/repos/chaotic.sh" # Interactive (gum confirm) - MUST be before AUR |
| 7 | - | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "AUR Support" | 7 | + | source "$ARCHUP_INSTALL/repos/aur.sh" # Interactive (gum confirm + choose) |
| 8 | - | echo | |||
| 9 | 8 | ||||
| 10 | - | if gum confirm "Enable AUR support?" --padding "0 0 1 $PADDING_LEFT"; then | |||
| 11 | - | export ARCHUP_AUR="enabled" | |||
| 12 | - | ||||
| 13 | - | # Choose AUR helper | |||
| 14 | - | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Choose AUR Helper" | |||
| 15 | - | AUR_HELPER=$(gum choose --cursor.foreground 6 --padding "0 0 1 $PADDING_LEFT" "paru" "yay") | |||
| 16 | - | ||||
| 17 | - | if [ "$AUR_HELPER" = "paru" ]; then | |||
| 18 | - | source "$ARCHUP_INSTALL/repos/paru.sh" | |||
| 19 | - | else | |||
| 20 | - | source "$ARCHUP_INSTALL/repos/yay.sh" | |||
| 21 | - | fi | |||
| 22 | - | else | |||
| 23 | - | gum style --foreground 3 --padding "0 0 1 $PADDING_LEFT" "[SKIP] Skipping AUR support" | |||
| 24 | - | echo "AUR: disabled" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 25 | - | export ARCHUP_AUR="disabled" | |||
| 26 | - | fi | |||
| 27 | - | ||||
| 28 | - | source "$ARCHUP_INSTALL/repos/chaotic.sh" # Interactive (gum confirm) | |||
| 29 | start_log_output # Resume (will be stopped by stop_install_log) | 9 | start_log_output # Resume (will be stopped by stop_install_log) | ||
A install/repos/aur.sh +85 -0
| @@ -0,0 +1,85 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | # AUR helper installation - consolidated paru and yay | |
| 3 | + | ||
| 4 | + | # Function to install paru (available in chaotic-aur) | |
| 5 | + | install_paru() { | |
| 6 | + | local username="$1" | |
| 7 | + | echo "Installing paru from chaotic-aur..." >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 8 | + | ||
| 9 | + | if ! run_with_spinner "Installing paru AUR helper..." "arch-chroot /mnt pacman -S --noconfirm paru"; then | |
| 10 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] paru installation failed" | |
| 11 | + | echo "ERROR: paru installation failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 12 | + | export ARCHUP_AUR="failed" | |
| 13 | + | return 1 | |
| 14 | + | fi | |
| 15 | + | ||
| 16 | + | # Verify installation | |
| 17 | + | if arch-chroot /mnt su - "${username}" -c "paru --version" >/dev/null 2>&1; then | |
| 18 | + | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "[OK] paru installed successfully" | |
| 19 | + | echo "AUR: enabled (paru installed for user: ${username})" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 20 | + | else | |
| 21 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] paru verification failed" | |
| 22 | + | echo "ERROR: paru verification failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 23 | + | export ARCHUP_AUR="failed" | |
| 24 | + | return 1 | |
| 25 | + | fi | |
| 26 | + | } | |
| 27 | + | ||
| 28 | + | # Function to install yay (available in chaotic-aur) | |
| 29 | + | install_yay() { | |
| 30 | + | local username="$1" | |
| 31 | + | echo "Installing yay from chaotic-aur..." >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 32 | + | ||
| 33 | + | if ! run_with_spinner "Installing yay AUR helper..." "arch-chroot /mnt pacman -S --noconfirm yay"; then | |
| 34 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] yay installation failed" | |
| 35 | + | echo "ERROR: yay installation failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 36 | + | export ARCHUP_AUR="failed" | |
| 37 | + | return 1 | |
| 38 | + | fi | |
| 39 | + | ||
| 40 | + | # Verify installation | |
| 41 | + | if arch-chroot /mnt su - "${username}" -c "yay --version" >/dev/null 2>&1; then | |
| 42 | + | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "[OK] yay installed successfully" | |
| 43 | + | echo "AUR: enabled (yay installed for user: ${username})" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 44 | + | else | |
| 45 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] yay verification failed" | |
| 46 | + | echo "ERROR: yay verification failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 47 | + | export ARCHUP_AUR="failed" | |
| 48 | + | return 1 | |
| 49 | + | fi | |
| 50 | + | } | |
| 51 | + | ||
| 52 | + | # Main execution | |
| 53 | + | # AUR Support prompt | |
| 54 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "AUR Support" | |
| 55 | + | echo | |
| 56 | + | ||
| 57 | + | if ! gum confirm "Enable AUR support?" --padding "0 0 1 $PADDING_LEFT"; then | |
| 58 | + | gum style --foreground 3 --padding "0 0 1 $PADDING_LEFT" "[SKIP] Skipping AUR support" | |
| 59 | + | echo "AUR: disabled" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 60 | + | export ARCHUP_AUR="disabled" | |
| 61 | + | return 0 | |
| 62 | + | fi | |
| 63 | + | ||
| 64 | + | export ARCHUP_AUR="enabled" | |
| 65 | + | ||
| 66 | + | # Choose AUR helper | |
| 67 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Choose AUR Helper" | |
| 68 | + | AUR_HELPER=$(gum choose --cursor.foreground 6 --padding "0 0 1 $PADDING_LEFT" "paru" "yay") | |
| 69 | + | ||
| 70 | + | # Get the username created during installation | |
| 71 | + | USERNAME=$(arch-chroot /mnt ls /home | head -1) | |
| 72 | + | ||
| 73 | + | if [[ -z "${USERNAME}" ]]; then | |
| 74 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Could not find user for AUR helper installation" | |
| 75 | + | echo "ERROR: No user found for AUR helper installation" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 76 | + | export ARCHUP_AUR="failed" | |
| 77 | + | return 1 | |
| 78 | + | fi | |
| 79 | + | ||
| 80 | + | # Install selected AUR helper (both available in chaotic-aur) | |
| 81 | + | if [ "$AUR_HELPER" = "paru" ]; then | |
| 82 | + | install_paru "$USERNAME" | |
| 83 | + | else | |
| 84 | + | install_yay "$USERNAME" | |
| 85 | + | fi | |
| @@ -0,0 +1,85 @@ | |||||
| 1 | + | #!/bin/bash | |||
| 2 | + | # AUR helper installation - consolidated paru and yay | |||
| 3 | + | ||||
| 4 | + | # Function to install paru (available in chaotic-aur) | |||
| 5 | + | install_paru() { | |||
| 6 | + | local username="$1" | |||
| 7 | + | echo "Installing paru from chaotic-aur..." >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 8 | + | ||||
| 9 | + | if ! run_with_spinner "Installing paru AUR helper..." "arch-chroot /mnt pacman -S --noconfirm paru"; then | |||
| 10 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] paru installation failed" | |||
| 11 | + | echo "ERROR: paru installation failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 12 | + | export ARCHUP_AUR="failed" | |||
| 13 | + | return 1 | |||
| 14 | + | fi | |||
| 15 | + | ||||
| 16 | + | # Verify installation | |||
| 17 | + | if arch-chroot /mnt su - "${username}" -c "paru --version" >/dev/null 2>&1; then | |||
| 18 | + | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "[OK] paru installed successfully" | |||
| 19 | + | echo "AUR: enabled (paru installed for user: ${username})" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 20 | + | else | |||
| 21 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] paru verification failed" | |||
| 22 | + | echo "ERROR: paru verification failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 23 | + | export ARCHUP_AUR="failed" | |||
| 24 | + | return 1 | |||
| 25 | + | fi | |||
| 26 | + | } | |||
| 27 | + | ||||
| 28 | + | # Function to install yay (available in chaotic-aur) | |||
| 29 | + | install_yay() { | |||
| 30 | + | local username="$1" | |||
| 31 | + | echo "Installing yay from chaotic-aur..." >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 32 | + | ||||
| 33 | + | if ! run_with_spinner "Installing yay AUR helper..." "arch-chroot /mnt pacman -S --noconfirm yay"; then | |||
| 34 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] yay installation failed" | |||
| 35 | + | echo "ERROR: yay installation failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 36 | + | export ARCHUP_AUR="failed" | |||
| 37 | + | return 1 | |||
| 38 | + | fi | |||
| 39 | + | ||||
| 40 | + | # Verify installation | |||
| 41 | + | if arch-chroot /mnt su - "${username}" -c "yay --version" >/dev/null 2>&1; then | |||
| 42 | + | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "[OK] yay installed successfully" | |||
| 43 | + | echo "AUR: enabled (yay installed for user: ${username})" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 44 | + | else | |||
| 45 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] yay verification failed" | |||
| 46 | + | echo "ERROR: yay verification failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 47 | + | export ARCHUP_AUR="failed" | |||
| 48 | + | return 1 | |||
| 49 | + | fi | |||
| 50 | + | } | |||
| 51 | + | ||||
| 52 | + | # Main execution | |||
| 53 | + | # AUR Support prompt | |||
| 54 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "AUR Support" | |||
| 55 | + | echo | |||
| 56 | + | ||||
| 57 | + | if ! gum confirm "Enable AUR support?" --padding "0 0 1 $PADDING_LEFT"; then | |||
| 58 | + | gum style --foreground 3 --padding "0 0 1 $PADDING_LEFT" "[SKIP] Skipping AUR support" | |||
| 59 | + | echo "AUR: disabled" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 60 | + | export ARCHUP_AUR="disabled" | |||
| 61 | + | return 0 | |||
| 62 | + | fi | |||
| 63 | + | ||||
| 64 | + | export ARCHUP_AUR="enabled" | |||
| 65 | + | ||||
| 66 | + | # Choose AUR helper | |||
| 67 | + | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Choose AUR Helper" | |||
| 68 | + | AUR_HELPER=$(gum choose --cursor.foreground 6 --padding "0 0 1 $PADDING_LEFT" "paru" "yay") | |||
| 69 | + | ||||
| 70 | + | # Get the username created during installation | |||
| 71 | + | USERNAME=$(arch-chroot /mnt ls /home | head -1) | |||
| 72 | + | ||||
| 73 | + | if [[ -z "${USERNAME}" ]]; then | |||
| 74 | + | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Could not find user for AUR helper installation" | |||
| 75 | + | echo "ERROR: No user found for AUR helper installation" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 76 | + | export ARCHUP_AUR="failed" | |||
| 77 | + | return 1 | |||
| 78 | + | fi | |||
| 79 | + | ||||
| 80 | + | # Install selected AUR helper (both available in chaotic-aur) | |||
| 81 | + | if [ "$AUR_HELPER" = "paru" ]; then | |||
| 82 | + | install_paru "$USERNAME" | |||
| 83 | + | else | |||
| 84 | + | install_yay "$USERNAME" | |||
| 85 | + | fi | |||
D install/repos/paru.sh +0 -49
| @@ -1,49 +0,0 @@ | |||
| 1 | - | #!/bin/bash | |
| 2 | - | # Install paru AUR helper | |
| 3 | - | ||
| 4 | - | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Installing paru..." | |
| 5 | - | gum style --padding "0 0 1 $PADDING_LEFT" "This may take a few minutes..." | |
| 6 | - | ||
| 7 | - | # Install base-devel if not already installed (required for building AUR packages) | |
| 8 | - | arch-chroot /mnt pacman -S --noconfirm --needed base-devel git >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 9 | - | ||
| 10 | - | # Get the username created during installation | |
| 11 | - | USERNAME=$(arch-chroot /mnt ls /home | head -1) | |
| 12 | - | ||
| 13 | - | if [[ -z "${USERNAME}" ]]; then | |
| 14 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Could not find user for paru installation" | |
| 15 | - | echo "ERROR: No user found for paru installation" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 16 | - | export ARCHUP_AUR="failed" | |
| 17 | - | return 1 | |
| 18 | - | fi | |
| 19 | - | ||
| 20 | - | # Build paru as user and install as root | |
| 21 | - | echo "Building paru package..." >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 22 | - | if ! arch-chroot /mnt bash <<CHROOT_SCRIPT >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 23 | - | set -e | |
| 24 | - | set -u | |
| 25 | - | set -o pipefail | |
| 26 | - | cd /tmp | |
| 27 | - | su ${USERNAME} -c "git clone https://aur.archlinux.org/paru.git && cd paru && makepkg -s --noconfirm" | |
| 28 | - | cd paru | |
| 29 | - | pacman -U --noconfirm paru-*.pkg.tar.zst | |
| 30 | - | cd /tmp | |
| 31 | - | rm -rf paru | |
| 32 | - | CHROOT_SCRIPT | |
| 33 | - | then | |
| 34 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] paru installation failed" | |
| 35 | - | echo "ERROR: paru installation failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 36 | - | export ARCHUP_AUR="failed" | |
| 37 | - | return 1 | |
| 38 | - | fi | |
| 39 | - | ||
| 40 | - | # Verify installation | |
| 41 | - | if arch-chroot /mnt su - "${USERNAME}" -c "paru --version" >/dev/null 2>&1; then | |
| 42 | - | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "[OK] paru installed successfully" | |
| 43 | - | echo "AUR: enabled (paru installed for user: ${USERNAME})" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 44 | - | else | |
| 45 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] paru verification failed" | |
| 46 | - | echo "ERROR: paru verification failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 47 | - | export ARCHUP_AUR="failed" | |
| 48 | - | return 1 | |
| 49 | - | fi | |
| @@ -1,49 +0,0 @@ | |||||
| 1 | - | #!/bin/bash | |||
| 2 | - | # Install paru AUR helper | |||
| 3 | - | ||||
| 4 | - | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Installing paru..." | |||
| 5 | - | gum style --padding "0 0 1 $PADDING_LEFT" "This may take a few minutes..." | |||
| 6 | - | ||||
| 7 | - | # Install base-devel if not already installed (required for building AUR packages) | |||
| 8 | - | arch-chroot /mnt pacman -S --noconfirm --needed base-devel git >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |||
| 9 | - | ||||
| 10 | - | # Get the username created during installation | |||
| 11 | - | USERNAME=$(arch-chroot /mnt ls /home | head -1) | |||
| 12 | - | ||||
| 13 | - | if [[ -z "${USERNAME}" ]]; then | |||
| 14 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Could not find user for paru installation" | |||
| 15 | - | echo "ERROR: No user found for paru installation" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 16 | - | export ARCHUP_AUR="failed" | |||
| 17 | - | return 1 | |||
| 18 | - | fi | |||
| 19 | - | ||||
| 20 | - | # Build paru as user and install as root | |||
| 21 | - | echo "Building paru package..." >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 22 | - | if ! arch-chroot /mnt bash <<CHROOT_SCRIPT >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |||
| 23 | - | set -e | |||
| 24 | - | set -u | |||
| 25 | - | set -o pipefail | |||
| 26 | - | cd /tmp | |||
| 27 | - | su ${USERNAME} -c "git clone https://aur.archlinux.org/paru.git && cd paru && makepkg -s --noconfirm" | |||
| 28 | - | cd paru | |||
| 29 | - | pacman -U --noconfirm paru-*.pkg.tar.zst | |||
| 30 | - | cd /tmp | |||
| 31 | - | rm -rf paru | |||
| 32 | - | CHROOT_SCRIPT | |||
| 33 | - | then | |||
| 34 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] paru installation failed" | |||
| 35 | - | echo "ERROR: paru installation failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 36 | - | export ARCHUP_AUR="failed" | |||
| 37 | - | return 1 | |||
| 38 | - | fi | |||
| 39 | - | ||||
| 40 | - | # Verify installation | |||
| 41 | - | if arch-chroot /mnt su - "${USERNAME}" -c "paru --version" >/dev/null 2>&1; then | |||
| 42 | - | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "[OK] paru installed successfully" | |||
| 43 | - | echo "AUR: enabled (paru installed for user: ${USERNAME})" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 44 | - | else | |||
| 45 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] paru verification failed" | |||
| 46 | - | echo "ERROR: paru verification failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 47 | - | export ARCHUP_AUR="failed" | |||
| 48 | - | return 1 | |||
| 49 | - | fi | |||
D install/repos/yay.sh +0 -49
| @@ -1,49 +0,0 @@ | |||
| 1 | - | #!/bin/bash | |
| 2 | - | # Install yay AUR helper | |
| 3 | - | ||
| 4 | - | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Installing yay..." | |
| 5 | - | gum style --padding "0 0 1 $PADDING_LEFT" "This may take a few minutes..." | |
| 6 | - | ||
| 7 | - | # Install base-devel if not already installed (required for building AUR packages) | |
| 8 | - | arch-chroot /mnt pacman -S --noconfirm --needed base-devel git >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 9 | - | ||
| 10 | - | # Get the username created during installation | |
| 11 | - | USERNAME=$(arch-chroot /mnt ls /home | head -1) | |
| 12 | - | ||
| 13 | - | if [[ -z "${USERNAME}" ]]; then | |
| 14 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Could not find user for yay installation" | |
| 15 | - | echo "ERROR: No user found for yay installation" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 16 | - | export ARCHUP_AUR="failed" | |
| 17 | - | return 1 | |
| 18 | - | fi | |
| 19 | - | ||
| 20 | - | # Build yay as user and install as root | |
| 21 | - | echo "Building yay package..." >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 22 | - | if ! arch-chroot /mnt bash <<CHROOT_SCRIPT >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |
| 23 | - | set -e | |
| 24 | - | set -u | |
| 25 | - | set -o pipefail | |
| 26 | - | cd /tmp | |
| 27 | - | su ${USERNAME} -c "git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -s --noconfirm" | |
| 28 | - | cd yay-bin | |
| 29 | - | pacman -U --noconfirm yay-bin-*.pkg.tar.zst | |
| 30 | - | cd /tmp | |
| 31 | - | rm -rf yay-bin | |
| 32 | - | CHROOT_SCRIPT | |
| 33 | - | then | |
| 34 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] yay installation failed" | |
| 35 | - | echo "ERROR: yay installation failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 36 | - | export ARCHUP_AUR="failed" | |
| 37 | - | return 1 | |
| 38 | - | fi | |
| 39 | - | ||
| 40 | - | # Verify installation | |
| 41 | - | if arch-chroot /mnt su - "${USERNAME}" -c "yay --version" >/dev/null 2>&1; then | |
| 42 | - | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "[OK] yay installed successfully" | |
| 43 | - | echo "AUR: enabled (yay installed for user: ${USERNAME})" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 44 | - | else | |
| 45 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] yay verification failed" | |
| 46 | - | echo "ERROR: yay verification failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |
| 47 | - | export ARCHUP_AUR="failed" | |
| 48 | - | return 1 | |
| 49 | - | fi | |
| @@ -1,49 +0,0 @@ | |||||
| 1 | - | #!/bin/bash | |||
| 2 | - | # Install yay AUR helper | |||
| 3 | - | ||||
| 4 | - | gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Installing yay..." | |||
| 5 | - | gum style --padding "0 0 1 $PADDING_LEFT" "This may take a few minutes..." | |||
| 6 | - | ||||
| 7 | - | # Install base-devel if not already installed (required for building AUR packages) | |||
| 8 | - | arch-chroot /mnt pacman -S --noconfirm --needed base-devel git >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |||
| 9 | - | ||||
| 10 | - | # Get the username created during installation | |||
| 11 | - | USERNAME=$(arch-chroot /mnt ls /home | head -1) | |||
| 12 | - | ||||
| 13 | - | if [[ -z "${USERNAME}" ]]; then | |||
| 14 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Could not find user for yay installation" | |||
| 15 | - | echo "ERROR: No user found for yay installation" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 16 | - | export ARCHUP_AUR="failed" | |||
| 17 | - | return 1 | |||
| 18 | - | fi | |||
| 19 | - | ||||
| 20 | - | # Build yay as user and install as root | |||
| 21 | - | echo "Building yay package..." >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 22 | - | if ! arch-chroot /mnt bash <<CHROOT_SCRIPT >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1 | |||
| 23 | - | set -e | |||
| 24 | - | set -u | |||
| 25 | - | set -o pipefail | |||
| 26 | - | cd /tmp | |||
| 27 | - | su ${USERNAME} -c "git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -s --noconfirm" | |||
| 28 | - | cd yay-bin | |||
| 29 | - | pacman -U --noconfirm yay-bin-*.pkg.tar.zst | |||
| 30 | - | cd /tmp | |||
| 31 | - | rm -rf yay-bin | |||
| 32 | - | CHROOT_SCRIPT | |||
| 33 | - | then | |||
| 34 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] yay installation failed" | |||
| 35 | - | echo "ERROR: yay installation failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 36 | - | export ARCHUP_AUR="failed" | |||
| 37 | - | return 1 | |||
| 38 | - | fi | |||
| 39 | - | ||||
| 40 | - | # Verify installation | |||
| 41 | - | if arch-chroot /mnt su - "${USERNAME}" -c "yay --version" >/dev/null 2>&1; then | |||
| 42 | - | gum style --foreground 2 --padding "1 0 1 $PADDING_LEFT" "[OK] yay installed successfully" | |||
| 43 | - | echo "AUR: enabled (yay installed for user: ${USERNAME})" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 44 | - | else | |||
| 45 | - | gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] yay verification failed" | |||
| 46 | - | echo "ERROR: yay verification failed" >> "$ARCHUP_INSTALL_LOG_FILE" | |||
| 47 | - | export ARCHUP_AUR="failed" | |||
| 48 | - | return 1 | |||
| 49 | - | fi | |||