Make spinner robust and improve Gentoo bootstrap

Reset shell command hash in spinner and make sleep resilient to shells without redirected sleep, preventing stale PATH lookups and failures in background subshells. Improve Gentoo bootstrap by syncing portage (emerge-webrsync or emerge --sync), preferring binary packages (--getbinpkg --usepkg) before falling back to source emerge, and add a fallback fetcher: prefer curl but use wget if curl is unavailable; fail with a clear error if neither is present. Replace direct curl sourcing with a configurable _fetch command to support the wget fallback.
This commit is contained in:
CanbiZ (MickLesk)
2026-04-27 16:17:08 +02:00
parent 52765ca1e3
commit 268eb07bb3
2 changed files with 24 additions and 4 deletions

View File

@@ -551,13 +551,17 @@ silent() {
# - Uses color_spinner() colors for output
# ------------------------------------------------------------------------------
spinner() {
# Reset bash's command hash table — package upgrades (dnf/pacman) may have
# moved /usr/bin <-> /usr/sbin during /usr-merge, leaving the parent shell
# with stale cached paths that get inherited by this background subshell.
hash -r 2>/dev/null || true
local chars=(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏)
local msg="${SPINNER_MSG:-Processing...}"
local i=0
while true; do
local index=$((i++ % ${#chars[@]}))
printf "\r\033[2K%s %b" "${CS_YWB}${chars[$index]}${CS_CL}" "${CS_YWB}${msg}${CS_CL}"
sleep 0.1
sleep 0.1 2>/dev/null || command sleep 0.1 2>/dev/null || break
done
}