Fix stdin: use targeted /dev/tty redirects instead of exec
The exec < /dev/tty approach silently killed the script under set -e if /dev/tty wasn't accessible. Replace with surgical redirects on just the interactive reads and setup.sh invocation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
install.sh
13
install.sh
@@ -50,13 +50,6 @@ show_progress() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Reclaim stdin for interactive prompts ---
|
|
||||||
# When run via `curl ... | bash`, stdin is the pipe. Reopen it from
|
|
||||||
# the terminal so read prompts (setup wizard, confirmations) work.
|
|
||||||
if [ ! -t 0 ]; then
|
|
||||||
exec < /dev/tty
|
|
||||||
fi
|
|
||||||
|
|
||||||
header "WebsiteBox Installer"
|
header "WebsiteBox Installer"
|
||||||
|
|
||||||
# --- Check for root/sudo ---
|
# --- Check for root/sudo ---
|
||||||
@@ -102,7 +95,7 @@ case "$OS_ID" in
|
|||||||
*)
|
*)
|
||||||
warn "Unsupported OS detected (${OS_ID} ${OS_VERSION})."
|
warn "Unsupported OS detected (${OS_ID} ${OS_VERSION})."
|
||||||
warn "WebsiteBox is tested on Ubuntu 20.04+ and Debian 11+."
|
warn "WebsiteBox is tested on Ubuntu 20.04+ and Debian 11+."
|
||||||
read -rp "Continue anyway? (y/N) " cont
|
read -rp "Continue anyway? (y/N) " cont < /dev/tty
|
||||||
if [ "$cont" != "y" ] && [ "$cont" != "Y" ]; then
|
if [ "$cont" != "y" ] && [ "$cont" != "Y" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -257,9 +250,9 @@ echo ""
|
|||||||
if [ "$DOCKER_JUST_INSTALLED" = true ] && [ "$ACTUAL_USER" != "root" ]; then
|
if [ "$DOCKER_JUST_INSTALLED" = true ] && [ "$ACTUAL_USER" != "root" ]; then
|
||||||
# Activate docker group for this session without requiring logout/login
|
# Activate docker group for this session without requiring logout/login
|
||||||
info "Activating Docker permissions for current session..."
|
info "Activating Docker permissions for current session..."
|
||||||
sg docker -c "./setup.sh"
|
sg docker -c "./setup.sh < /dev/tty"
|
||||||
else
|
else
|
||||||
./setup.sh
|
./setup.sh < /dev/tty
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user