setup.sh: fix read for piped mode — detect non-interactive and skip prompt

This commit is contained in:
Ada
2026-04-06 10:25:16 -04:00
parent fd16032a91
commit 02e2c2687d

View File

@@ -34,6 +34,12 @@ if ! command -v curl &> /dev/null; then
exit 1
fi
# Detect interactive vs piped mode
INTERACTIVE=true
if [ ! -t 0 ]; then
INTERACTIVE=false
fi
# Check for Docker
DOCKER_INSTALLED=false
if command -v docker &> /dev/null; then
@@ -68,7 +74,8 @@ echo "Data: SQLite database is stored in a Docker named volume."
echo " Use 'docker compose down -v' to DELETE the database."
echo ""
# Confirm
# Confirm (skip in non-interactive/piped mode)
if [ "$INTERACTIVE" = "true" ]; then
echo -n "Continue? [Y/n]: "
read -r CONFIRM
CONFIRM=${CONFIRM:-Y}
@@ -76,6 +83,11 @@ if [ "$CONFIRM" != "Y" ] && [ "$CONFIRM" != "y" ]; then
echo "Aborted."
exit 0
fi
else
echo "(Running in non-interactive mode — proceeding automatically)"
echo "To interactively confirm, run: curl -sL ... | bash"
echo ""
fi
echo ""
echo "=== Starting deploy ==="