diff --git a/misc/core.func b/misc/core.func index 5d46742d..af668c42 100644 --- a/misc/core.func +++ b/misc/core.func @@ -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 } diff --git a/misc/install.func b/misc/install.func index 954fa2fa..d087af57 100644 --- a/misc/install.func +++ b/misc/install.func @@ -175,16 +175,32 @@ _bootstrap() { elif command -v pacman &>/dev/null; then pacman -Sy --noconfirm curl &>/dev/null elif command -v emerge &>/dev/null; then - emerge --quiet net-misc/curl &>/dev/null + # Gentoo stage3 has no curl and no portage tree on first boot. + # Sync portage (webrsync = fast snapshot) then prefer binary package. + emerge-webrsync --quiet &>/dev/null || emerge --sync --quiet &>/dev/null + emerge --quiet --getbinpkg --usepkg net-misc/curl &>/dev/null \ + || emerge --quiet net-misc/curl &>/dev/null fi fi + # Last resort: if curl still missing but wget is available (Gentoo stage3), + # use wget for the bootstrap source fetch so we don't fail immediately. + local _fetch + if command -v curl &>/dev/null; then + _fetch="curl -fsSL" + elif command -v wget &>/dev/null; then + _fetch="wget -qO-" + else + echo "ERROR: neither curl nor wget available — cannot bootstrap" >&2 + exit 1 + fi + # Configurable base URL for development — override with COMMUNITY_SCRIPTS_URL COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main}" # Source core functions - source <(curl -fsSL "$COMMUNITY_SCRIPTS_URL/misc/core.func") - source <(curl -fsSL "$COMMUNITY_SCRIPTS_URL/misc/error_handler.func") + source <($_fetch "$COMMUNITY_SCRIPTS_URL/misc/core.func") + source <($_fetch "$COMMUNITY_SCRIPTS_URL/misc/error_handler.func") load_functions catch_errors