From 05cde0a471082c7ee6a0a82e9e67236e17831201 Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Thu, 4 Dec 2025 10:39:00 -0500 Subject: [PATCH] Fix: Non-interactive mode and proper indentation --- install-ubuntu-root.sh | 48 ++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/install-ubuntu-root.sh b/install-ubuntu-root.sh index f53ee98..19175d2 100644 --- a/install-ubuntu-root.sh +++ b/install-ubuntu-root.sh @@ -33,10 +33,16 @@ echo " - Install dependencies" echo " - Set up systemd service" echo " - Open firewall port 3001" echo "" -read -p "Continue? (y/n) " -n 1 -r -echo "" -if [[ ! $REPLY =~ ^[Yy]$ ]]; then - exit 1 + +# Skip confirmation if running non-interactively or with -y flag +if [ -t 0 ]; then + read -p "Continue? (y/n) " -n 1 -r + echo "" + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + exit 1 + fi +else + echo "Running in non-interactive mode, continuing..." fi # Update system @@ -101,11 +107,14 @@ echo "⚙️ Step 7: Setting up configuration..." if [ ! -f ".env" ]; then cp .env.example .env echo "✅ Created .env file" - echo "" - echo "📝 Configure your settings:" - read -p "Enable email notifications? (y/n) " -n 1 -r - echo "" - if [[ $REPLY =~ ^[Yy]$ ]]; then + + # Skip interactive config if running non-interactively + if [ -t 0 ]; then + echo "" + echo "📝 Configure your settings:" + read -p "Enable email notifications? (y/n) " -n 1 -r + echo "" + if [[ $REPLY =~ ^[Yy]$ ]]; then read -p "SMTP Host (e.g., smtp.gmail.com): " SMTP_HOST read -p "SMTP Port (e.g., 587): " SMTP_PORT read -p "Email Username: " EMAIL_USER @@ -121,15 +130,18 @@ if [ ! -f ".env" ]; then sed -i "s/EMAIL_PASS=your-app-password/EMAIL_PASS=$EMAIL_PASS/" .env sed -i "s/EMAIL_FROM=your-email@gmail.com/EMAIL_FROM=$EMAIL_FROM/" .env sed -i "s/EMAIL_TO=your-email@gmail.com/EMAIL_TO=$EMAIL_TO/" .env - fi - - echo "" - read -p "Enable webhook notifications? (y/n) " -n 1 -r - echo "" - if [[ $REPLY =~ ^[Yy]$ ]]; then - read -p "Webhook URL: " WEBHOOK_URL - sed -i "s/WEBHOOK_ENABLED=false/WEBHOOK_ENABLED=true/" .env - sed -i "s|WEBHOOK_URL=https://your-webhook-url.com|WEBHOOK_URL=$WEBHOOK_URL|" .env + fi + + echo "" + read -p "Enable webhook notifications? (y/n) " -n 1 -r + echo "" + if [[ $REPLY =~ ^[Yy]$ ]]; then + read -p "Webhook URL: " WEBHOOK_URL + sed -i "s/WEBHOOK_ENABLED=false/WEBHOOK_ENABLED=true/" .env + sed -i "s|WEBHOOK_URL=https://your-webhook-url.com|WEBHOOK_URL=$WEBHOOK_URL|" .env + fi + else + echo "⚠️ Running non-interactively. You can configure notifications later in $INSTALL_DIR/.env" fi else echo "✅ .env file already exists"