From f54b5cd58248bfad1df311e1af9bfbc44e4cef0c Mon Sep 17 00:00:00 2001 From: NixReaper Date: Thu, 23 Apr 2026 17:43:05 -0500 Subject: [PATCH] fix: self-update + fold PPA into packages step On Ubuntu 24.04, PHP 8.2 is not in the default apt repos. The ondrej/php PPA must be added before package installation. Previously this was a separate step that could be bypassed when running a locally-cached (pre-fix) copy of install.sh. Changes: - Add self-update block: script fetches latest version from GitHub and re-execs itself, so stale local copies are never used - Remove standalone php_ppa step; PPA is now added unconditionally inside the packages step (checks if already present to avoid duplicate adds on re-runs) - Idempotent: grep checks sources.list before calling add-apt-repository --- install.sh | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index b60bc07..fb29f67 100644 --- a/install.sh +++ b/install.sh @@ -6,6 +6,20 @@ # ────────────────────────────────────────────────────────────────────────────── set -euo pipefail +# ── Self-update ─────────────────────────────────────────────────────────────── +# Always re-exec from the latest version on GitHub so stale local copies +# never silently run outdated logic. +SELF_URL="https://raw.githubusercontent.com/NixReaper/nixpanel/main/install.sh" +if [[ -z "${NIXPANEL_SELF_UPDATED:-}" ]]; then + echo "Fetching latest installer from GitHub…" + LATEST_SCRIPT=$(curl -fsSL "$SELF_URL") \ + || { echo "[WARN] Could not reach GitHub — running local copy"; LATEST_SCRIPT=""; } + if [[ -n "$LATEST_SCRIPT" ]]; then + export NIXPANEL_SELF_UPDATED=1 + exec bash <(printf '%s' "$LATEST_SCRIPT") "$@" + fi +fi + # ── Colours ─────────────────────────────────────────────────────────────────── RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m' YELLOW='\033[1;33m'; BOLD='\033[1m'; RESET='\033[0m' @@ -75,22 +89,22 @@ if ! step_done "resolved_stub"; then fi success "Port 53 free" -# ── 3. ondrej/php PPA (required for PHP 8.2 on Ubuntu 24.04) ───────────────── -step "Adding ondrej/php PPA" -if ! step_done "php_ppa"; then - export DEBIAN_FRONTEND=noninteractive - # Install prereqs for add-apt-repository - apt-get install -y -qq ca-certificates gnupg software-properties-common - add-apt-repository -y ppa:ondrej/php - apt-get update -qq - mark_done "php_ppa" -fi -success "ondrej/php PPA added" - -# ── 4. System packages ──────────────────────────────────────────────────────── +# ── 3. System packages (including ondrej/php PPA for PHP 8.2 on Ubuntu 24.04) ─ step "Installing system packages" if ! step_done "packages"; then export DEBIAN_FRONTEND=noninteractive + + # Ensure PPA tooling is present, then add ondrej/php for PHP 8.2 + apt-get install -y -qq ca-certificates gnupg software-properties-common + if ! grep -rq "ondrej/php" /etc/apt/sources.list /etc/apt/sources.list.d/ 2>/dev/null; then + info "Adding ondrej/php PPA (required for PHP 8.2 on Ubuntu 24.04)…" + add-apt-repository -y ppa:ondrej/php + apt-get update -qq + success "ondrej/php PPA added" + else + info "ondrej/php PPA already present" + fi + apt-get install -y -qq \ build-essential pkg-config libssl-dev libmariadb-dev curl wget git unzip \ ca-certificates gnupg software-properties-common \