Fix curl|bash install: redirect stdin from /dev/tty for interactive prompts
When piped (curl | bash), stdin is the curl output, not the terminal. All read prompts in config.sh were reading leftover pipe data or EOF, causing infinite password validation loops and garbage domain values. Bunker Admin
This commit is contained in:
parent
7287328148
commit
f2284a9cdf
13
config.sh
13
config.sh
@ -32,6 +32,19 @@ else
|
||||
RED='' GREEN='' YELLOW='' BLUE='' CYAN='' BOLD='' DIM='' NC=''
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Ensure stdin is connected to the terminal (handles curl | bash case)
|
||||
# =============================================================================
|
||||
if [[ ! -t 0 ]]; then
|
||||
if [[ -e /dev/tty ]]; then
|
||||
exec 0</dev/tty
|
||||
else
|
||||
echo "[ERR] This script requires an interactive terminal." >&2
|
||||
echo " Download and run manually: bash config.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Utility Functions
|
||||
# =============================================================================
|
||||
|
||||
@ -224,7 +224,13 @@ echo ""
|
||||
echo -e "${BOLD}Starting configuration wizard...${NC}"
|
||||
echo ""
|
||||
cd "$INSTALL_DIR"
|
||||
bash config.sh
|
||||
# Redirect stdin from terminal — when piped (curl | bash), stdin is the pipe,
|
||||
# so interactive prompts in config.sh would read garbage instead of user input.
|
||||
if [[ -e /dev/tty ]]; then
|
||||
bash config.sh </dev/tty
|
||||
else
|
||||
bash config.sh
|
||||
fi
|
||||
CONFIG_COMPLETE=true
|
||||
|
||||
# =============================================================================
|
||||
@ -239,6 +245,9 @@ START_SERVICES="y"
|
||||
if [[ -t 0 ]]; then
|
||||
read -rp "Start all services now? [Y/n]: " START_SERVICES
|
||||
START_SERVICES=${START_SERVICES:-y}
|
||||
elif [[ -e /dev/tty ]]; then
|
||||
read -rp "Start all services now? [Y/n]: " START_SERVICES </dev/tty
|
||||
START_SERVICES=${START_SERVICES:-y}
|
||||
fi
|
||||
|
||||
if [[ "$START_SERVICES" =~ ^[Yy]$ ]]; then
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user