From 3e78c7cb2ae6e6d98d1e2372583de1e4a3d4f521 Mon Sep 17 00:00:00 2001 From: The_miro Date: Fri, 22 May 2026 05:04:55 +0200 Subject: [PATCH] fix(installer): allow root execution in archiso by shimming sudo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running as root (archiso chroot context), all three TUI installers previously died immediately. Replace the hard die with a sudo passthrough shim ($TMP_D/bin/sudo → exec "$@") prepended to PATH, so every module's `sudo pacman`, `sudo systemctl` etc. just executes directly as root. The shim lives in TMP_D and is cleaned up by the existing EXIT trap. Co-Authored-By: Claude Sonnet 4.6 --- setup/install-modules.sh | 8 +++++++- setup/simple-install.sh | 8 +++++++- setup/tui-install.sh | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/setup/install-modules.sh b/setup/install-modules.sh index fa9a891..40c0ba0 100755 --- a/setup/install-modules.sh +++ b/setup/install-modules.sh @@ -149,7 +149,13 @@ count_steps() { [[ "$sel" == *"kate"* ]] && TOTAL=$(( TOTAL + 1 )) } -[[ $EUID -eq 0 ]] && die "Run as your normal user (not root)." +if [[ $EUID -eq 0 ]]; then + # Root context (e.g. archiso chroot): shim sudo as a passthrough + mkdir -p "$TMP_D/bin" + printf '#!/bin/bash\nexec "$@"\n' > "$TMP_D/bin/sudo" + chmod +x "$TMP_D/bin/sudo" + export PATH="$TMP_D/bin:$PATH" +fi command -v pacman &>/dev/null || die "pacman not found — Arch Linux required." require_dialog diff --git a/setup/simple-install.sh b/setup/simple-install.sh index f5f9ec5..488ed06 100755 --- a/setup/simple-install.sh +++ b/setup/simple-install.sh @@ -395,7 +395,13 @@ get_mac_suffix() { } # ── Preflight ───────────────────────────────────────────────────────────────── -[[ $EUID -eq 0 ]] && die "Run as your normal user (not root)." +if [[ $EUID -eq 0 ]]; then + # Root context (e.g. archiso chroot): shim sudo as a passthrough + mkdir -p "$TMP_D/bin" + printf '#!/bin/bash\nexec "$@"\n' > "$TMP_D/bin/sudo" + chmod +x "$TMP_D/bin/sudo" + export PATH="$TMP_D/bin:$PATH" +fi command -v pacman &>/dev/null || die "pacman not found — Arch Linux required." if $ANSWERFILE_MODE; then diff --git a/setup/tui-install.sh b/setup/tui-install.sh index 721d17e..27e5bbe 100755 --- a/setup/tui-install.sh +++ b/setup/tui-install.sh @@ -220,7 +220,13 @@ get_mac_suffix() { } # ── Preflight ───────────────────────────────────────────────────────────────── -[[ $EUID -eq 0 ]] && die "Run as your normal user (not root)." +if [[ $EUID -eq 0 ]]; then + # Root context (e.g. archiso chroot): shim sudo as a passthrough + mkdir -p "$TMP_D/bin" + printf '#!/bin/bash\nexec "$@"\n' > "$TMP_D/bin/sudo" + chmod +x "$TMP_D/bin/sudo" + export PATH="$TMP_D/bin:$PATH" +fi command -v pacman &>/dev/null || die "pacman not found — Arch Linux required." require_dialog