From 5e7fd61f02320dc29c90083184c861bc0664da63 Mon Sep 17 00:00:00 2001 From: rain Date: Mon, 22 Jun 2026 15:17:58 -0400 Subject: [PATCH] Skip-sudo fixes for run_once_40 and run_once_20 Three real bugs caught during the bit-cachyos deploy: 1. wl-clipboard false-positive: 'command -v wl-clipboard' returns nothing because the package ships wl-copy/wl-paste, not a 'wl-clipboard' binary. Sudo pacman was being called every apply even though wl-clipboard is installed. Fix: declare -A PKG_BIN map in the script. 2. omp segfault aborts the whole bootstrap: on rye, 'bun add -g @oh-my-pi/pi-coding-agent' segfaults (Pi undervoltage, see pitfall #30). The 'set -e' caused the whole run_once_20 to abort before getting to neovim/oh-my-zsh/zshrc etc. Fix: wrap the bun add in a subshell with error tolerance, log a warning, keep going. 3. rorclar/sourdough reference cleanup: removed the old chaotic-aur comment which mentioned the wrong sudo pattern (now fixed in the other run_once scripts). Re-applied on bit, miche, byte, kaiser, crouton (rye skipped because of the undervoltage hardware issue). --- run_once_20-install-user-packages.sh.tmpl | 18 ++++++++++++++++-- run_once_40-install-sway.sh.tmpl | 11 ++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/run_once_20-install-user-packages.sh.tmpl b/run_once_20-install-user-packages.sh.tmpl index 1ceb58e..909ff2f 100755 --- a/run_once_20-install-user-packages.sh.tmpl +++ b/run_once_20-install-user-packages.sh.tmpl @@ -52,7 +52,14 @@ fi if command -v bun >/dev/null 2>&1; then if ! command -v omp >/dev/null 2>&1; then log "installing @oh-my-pi/pi-coding-agent via bun global" - bun add -g @oh-my-pi/pi-coding-agent 2>&1 | tail -10 + # Wrap in subshell so a segfault/timeout (e.g. Pi undervoltage + # killing the install mid-run, see pitfall #30) doesn't abort + # the whole bootstrap. omp can be retried manually later. + if (bun add -g @oh-my-pi/pi-coding-agent 2>&1 | tail -10); then + log "omp installed: $(omp --version 2>&1 | head -1)" + else + log "WARNING: bun add -g failed; omp not installed. Retry manually." + fi else log "omp already installed: $(omp --version 2>&1 | head -1)" fi @@ -114,7 +121,14 @@ fi if command -v bun >/dev/null 2>&1; then if ! command -v omp >/dev/null 2>&1; then log "installing @oh-my-pi/pi-coding-agent via bun global" - bun add -g @oh-my-pi/pi-coding-agent 2>&1 | tail -10 + # Wrap in subshell so a segfault/timeout (e.g. Pi undervoltage + # killing the install mid-run, see pitfall #30) doesn't abort + # the whole bootstrap. omp can be retried manually later. + if (bun add -g @oh-my-pi/pi-coding-agent 2>&1 | tail -10); then + log "omp installed: $(omp --version 2>&1 | head -1)" + else + log "WARNING: bun add -g failed; omp not installed. Retry manually." + fi else log "omp already installed: $(omp --version 2>&1 | head -1)" fi diff --git a/run_once_40-install-sway.sh.tmpl b/run_once_40-install-sway.sh.tmpl index 53e90b7..5225411 100644 --- a/run_once_40-install-sway.sh.tmpl +++ b/run_once_40-install-sway.sh.tmpl @@ -40,9 +40,18 @@ log "checking sway stack: ${SWAY_PKGS[*]}" # Only invoke sudo if any of the packages are missing. Bit has most # already; byte/kaiser are full. This avoids a no-op sudo prompt. +# +# Note: a few packages ship their CLI binary under a different name +# (e.g. wl-clipboard provides wl-copy/wl-paste, not `wl-clipboard`). +# Map those to the actual binary we use. +declare -A PKG_BIN=( + [wl-clipboard]="wl-copy" + [mako]="mako" +) MISSING_PKGS=() for p in "${SWAY_PKGS[@]}"; do - if ! command -v "$p" >/dev/null 2>&1; then + bin="${PKG_BIN[$p]:-$p}" + if ! command -v "$bin" >/dev/null 2>&1; then MISSING_PKGS+=("$p") fi done