detached 04812b1

fix(install): improve error handling and output control

- Add set -E flag to propagate ERR traps through subshells
- Fix cleanup script execution to avoid inheriting parent shell flags
- Remove invalid --noconfirm flag from pacstrap (auto-enabled by default)
- Fix spinner output leaking by removing tee redirection
- Add --noconfirm to all pacman -Sy commands for consistency
- Add || true to pgrep in cleanup to handle no-process-found case
commit
04812b147d1fbf9676b1de685fcc66359e97f44c
author
bnema · · 2025-10-21 16:16 UTC
committer
bnema · · 2025-10-21 21:14 UTC
parent
740acb2
signature
unsigned
8 files · +16 -10
M CHANGELOG.md +3 -0
@@ -18,6 +18,9 @@ All notable changes to this project will be documented in this file.
1818
1919 ### Fixed
2020 - **Help flag**: Moved --help check before any side effects for proper argument parsing
21+- **Error handling**: Fixed ERR trap propagation with set -E and proper cleanup execution
22+- **Spinner output**: Fixed package installation output leaking through spinner display
23+- **Cleanup flag**: Fixed --cleanup flag triggering false errors from pgrep exit codes
2124
2225 ## [0.2.0] - 2025-10-21
2326
@@ -18,6 +18,9 @@ All notable changes to this project will be documented in this file.
18 18
19 ### Fixed19 ### Fixed
20 - **Help flag**: Moved --help check before any side effects for proper argument parsing20 - **Help flag**: Moved --help check before any side effects for proper argument parsing
21+- **Error handling**: Fixed ERR trap propagation with set -E and proper cleanup execution
22+- **Spinner output**: Fixed package installation output leaking through spinner display
23+- **Cleanup flag**: Fixed --cleanup flag triggering false errors from pgrep exit codes
21 24
22 ## [0.2.0] - 2025-10-2125 ## [0.2.0] - 2025-10-21
23 26
M install.sh +3 -2
@@ -2,7 +2,7 @@
22 # ArchUp - Fast, minimal Arch Linux auto-installer
33 # Main installation orchestrator
44
5-set -eo pipefail
5+set -Eeo pipefail
66
77 # Handle help flag FIRST - before any side effects
88 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
@@ -70,7 +70,8 @@ source "$ARCHUP_INSTALL/helpers/all.sh"
7070 # Handle cleanup flag (after helpers are available)
7171 if [ "$1" = "--cleanup" ]; then
7272 echo "Running cleanup before installation..."
73- source "$ARCHUP_INSTALL/helpers/cleanup.sh" default
73+ # Run cleanup in subshell to avoid inheriting set -Eeo pipefail
74+ bash "$ARCHUP_INSTALL/helpers/cleanup.sh" default
7475 fi
7576
7677 # Display logo
@@ -2,7 +2,7 @@
2 # ArchUp - Fast, minimal Arch Linux auto-installer2 # ArchUp - Fast, minimal Arch Linux auto-installer
3 # Main installation orchestrator3 # Main installation orchestrator
4 4
5-set -eo pipefail5+set -Eeo pipefail
6 6
7 # Handle help flag FIRST - before any side effects7 # Handle help flag FIRST - before any side effects
8 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then8 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
@@ -70,7 +70,8 @@ source "$ARCHUP_INSTALL/helpers/all.sh"
70 # Handle cleanup flag (after helpers are available)70 # Handle cleanup flag (after helpers are available)
71 if [ "$1" = "--cleanup" ]; then71 if [ "$1" = "--cleanup" ]; then
72 echo "Running cleanup before installation..."72 echo "Running cleanup before installation..."
73- source "$ARCHUP_INSTALL/helpers/cleanup.sh" default73+ # Run cleanup in subshell to avoid inheriting set -Eeo pipefail
74+ bash "$ARCHUP_INSTALL/helpers/cleanup.sh" default
74 fi75 fi
75 76
76 # Display logo77 # Display logo
M install/base/enable-multilib.sh +1 -1
@@ -7,7 +7,7 @@ gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Enabling multilib repo
77 enable_multilib "/etc/pacman.conf"
88
99 # Update package database
10-if ! run_with_spinner "Updating package database..." "pacman -Sy"; then
10+if ! run_with_spinner "Updating package database..." "pacman -Sy --noconfirm"; then
1111 gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Failed to update package database"
1212 exit 1
1313 fi
@@ -7,7 +7,7 @@ gum style --foreground 6 --padding "1 0 0 $PADDING_LEFT" "Enabling multilib repo
7 enable_multilib "/etc/pacman.conf"7 enable_multilib "/etc/pacman.conf"
8 8
9 # Update package database9 # Update package database
10-if ! run_with_spinner "Updating package database..." "pacman -Sy"; then10+if ! run_with_spinner "Updating package database..." "pacman -Sy --noconfirm"; then
11 gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Failed to update package database"11 gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Failed to update package database"
12 exit 112 exit 1
13 fi13 fi
M install/base/pacstrap.sh +1 -0
@@ -23,6 +23,7 @@ if [ "$ARCHUP_ENCRYPTION" = "enabled" ]; then
2323 fi
2424
2525 # Install base system with spinner
26+# Note: pacstrap automatically runs with --noconfirm unless -i flag is used
2627 echo "Installing ${#packages[@]} packages: ${packages[*]}" >> "$ARCHUP_INSTALL_LOG_FILE"
2728 if ! run_with_spinner "Installing base system (${#packages[@]} packages)..." "pacstrap /mnt ${packages[*]}"; then
2829 gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Base system installation failed"
@@ -23,6 +23,7 @@ if [ "$ARCHUP_ENCRYPTION" = "enabled" ]; then
23 fi23 fi
24 24
25 # Install base system with spinner25 # Install base system with spinner
26+# Note: pacstrap automatically runs with --noconfirm unless -i flag is used
26 echo "Installing ${#packages[@]} packages: ${packages[*]}" >> "$ARCHUP_INSTALL_LOG_FILE"27 echo "Installing ${#packages[@]} packages: ${packages[*]}" >> "$ARCHUP_INSTALL_LOG_FILE"
27 if ! run_with_spinner "Installing base system (${#packages[@]} packages)..." "pacstrap /mnt ${packages[*]}"; then28 if ! run_with_spinner "Installing base system (${#packages[@]} packages)..." "pacstrap /mnt ${packages[*]}"; then
28 gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Base system installation failed"29 gum style --foreground 1 --padding "1 0 1 $PADDING_LEFT" "[ERROR] Base system installation failed"
M install/helpers/cleanup.sh +2 -1
@@ -140,7 +140,8 @@ cleanup_processes() {
140140 log_cleanup "Checking for stuck pacstrap/chroot processes..."
141141
142142 # Kill any stuck pacstrap or arch-chroot processes
143- local stuck_pids=$(pgrep -f "pacstrap|arch-chroot" 2>/dev/null)
143+ # Note: pgrep returns 1 if no processes found, which is expected/normal
144+ local stuck_pids=$(pgrep -f "pacstrap|arch-chroot" 2>/dev/null || true)
144145 if [ -n "$stuck_pids" ]; then
145146 log_cleanup "Killing stuck processes: $stuck_pids"
146147 kill $stuck_pids 2>/dev/null || true
@@ -140,7 +140,8 @@ cleanup_processes() {
140 log_cleanup "Checking for stuck pacstrap/chroot processes..."140 log_cleanup "Checking for stuck pacstrap/chroot processes..."
141 141
142 # Kill any stuck pacstrap or arch-chroot processes142 # Kill any stuck pacstrap or arch-chroot processes
143- local stuck_pids=$(pgrep -f "pacstrap|arch-chroot" 2>/dev/null)143+ # Note: pgrep returns 1 if no processes found, which is expected/normal
144+ local stuck_pids=$(pgrep -f "pacstrap|arch-chroot" 2>/dev/null || true)
144 if [ -n "$stuck_pids" ]; then145 if [ -n "$stuck_pids" ]; then
145 log_cleanup "Killing stuck processes: $stuck_pids"146 log_cleanup "Killing stuck processes: $stuck_pids"
146 kill $stuck_pids 2>/dev/null || true147 kill $stuck_pids 2>/dev/null || true
M install/helpers/logging.sh +1 -2
@@ -52,9 +52,8 @@ run_logged() {
5252
5353 echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting: $script" >> "$ARCHUP_INSTALL_LOG_FILE"
5454
55- # Don't start/stop log monitor here - it runs continuously once started
5655 # Source helpers in subshell before running the script so functions are available
57- # Redirect output to log but allow gum to access terminal for display
56+ # Redirect output to log file only
5857 bash -c "source '$ARCHUP_INSTALL/helpers/all.sh' && source '$script'" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1
5958
6059 local exit_code=$?
@@ -52,9 +52,8 @@ run_logged() {
52 52
53 echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting: $script" >> "$ARCHUP_INSTALL_LOG_FILE"53 echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting: $script" >> "$ARCHUP_INSTALL_LOG_FILE"
54 54
55- # Don't start/stop log monitor here - it runs continuously once started
56 # Source helpers in subshell before running the script so functions are available55 # Source helpers in subshell before running the script so functions are available
57- # Redirect output to log but allow gum to access terminal for display56+ # Redirect output to log file only
58 bash -c "source '$ARCHUP_INSTALL/helpers/all.sh' && source '$script'" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&157 bash -c "source '$ARCHUP_INSTALL/helpers/all.sh' && source '$script'" >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1
59 58
60 local exit_code=$?59 local exit_code=$?
M install/helpers/presentation.sh +4 -3
@@ -81,9 +81,10 @@ run_with_spinner() {
8181 local title="$1"
8282 local command="$2"
8383
84- # Redirect only stderr to terminal for gum display
85- # Command output goes to log file, spinner animation displays on terminal
86- if gum spin --spinner dot --title "$title" -- bash -c "$command >> \"$ARCHUP_INSTALL_LOG_FILE\" 2>&1" 2>/dev/tty; then
84+ # Run command with spinner, output goes only to log file
85+ # If command fails, error will be caught by ERR trap and shown in error handler
86+ if gum spin --spinner dot --title "$title" -- \
87+ bash -c "$command >> \"$ARCHUP_INSTALL_LOG_FILE\" 2>&1"; then
8788 return 0
8889 else
8990 return 1
@@ -81,9 +81,10 @@ run_with_spinner() {
81 local title="$1"81 local title="$1"
82 local command="$2"82 local command="$2"
83 83
84- # Redirect only stderr to terminal for gum display84+ # Run command with spinner, output goes only to log file
85- # Command output goes to log file, spinner animation displays on terminal85+ # If command fails, error will be caught by ERR trap and shown in error handler
86- if gum spin --spinner dot --title "$title" -- bash -c "$command >> \"$ARCHUP_INSTALL_LOG_FILE\" 2>&1" 2>/dev/tty; then86+ if gum spin --spinner dot --title "$title" -- \
87+ bash -c "$command >> \"$ARCHUP_INSTALL_LOG_FILE\" 2>&1"; then
87 return 088 return 0
88 else89 else
89 return 190 return 1
M install/repos/chaotic.sh +1 -1
@@ -27,7 +27,7 @@ EOF
2727 fi
2828
2929 # Update package databases
30-arch-chroot /mnt pacman -Sy >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1
30+arch-chroot /mnt pacman -Sy --noconfirm >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1
3131
3232 # Verify Chaotic-AUR is working
3333 if arch-chroot /mnt pacman -Sl chaotic-aur >/dev/null 2>&1; then
@@ -27,7 +27,7 @@ EOF
27 fi27 fi
28 28
29 # Update package databases29 # Update package databases
30-arch-chroot /mnt pacman -Sy >> "$ARCHUP_INSTALL_LOG_FILE" 2>&130+arch-chroot /mnt pacman -Sy --noconfirm >> "$ARCHUP_INSTALL_LOG_FILE" 2>&1
31 31
32 # Verify Chaotic-AUR is working32 # Verify Chaotic-AUR is working
33 if arch-chroot /mnt pacman -Sl chaotic-aur >/dev/null 2>&1; then33 if arch-chroot /mnt pacman -Sl chaotic-aur >/dev/null 2>&1; then

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 0

    ↑↓ moveenter openesc close