From a05c5030641cceeb1cfaa17b55225e73f2ba9b9a Mon Sep 17 00:00:00 2001 From: Chuck Date: Fri, 9 Jan 2026 17:28:53 -0500 Subject: [PATCH] fix: Remove user confirmation prompts in install_wifi_monitor.sh for non-interactive mode Make install_wifi_monitor.sh respect non-interactive mode: 1. Package installation prompt (line 48): - Check for ASSUME_YES or LEDMATRIX_ASSUME_YES environment variable - If set, automatically install required packages without prompting - If stdin is not a TTY (non-interactive), also auto-install packages - Only prompt user in true interactive mode (TTY available) 2. Continue installation prompt (line 145): - Already checks for ASSUME_YES, but now also checks LEDMATRIX_ASSUME_YES - Skip prompt if stdin is not a TTY - Proceed automatically in non-interactive mode This fixes installation failures at step 8.5 when running via one-shot installer or with -y flag, as the script was hanging on user prompts. --- scripts/install/install_wifi_monitor.sh | 34 +++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/scripts/install/install_wifi_monitor.sh b/scripts/install/install_wifi_monitor.sh index 58855ebe..e964df87 100755 --- a/scripts/install/install_wifi_monitor.sh +++ b/scripts/install/install_wifi_monitor.sh @@ -45,14 +45,32 @@ if [ ${#MISSING_PACKAGES[@]} -gt 0 ]; then echo " - $pkg" done echo "" - read -p "Install these packages now? (y/N): " -n 1 -r - echo "" - if [[ $REPLY =~ ^[Yy]$ ]]; then + + # Check for non-interactive mode (ASSUME_YES or LEDMATRIX_ASSUME_YES) + ASSUME_YES=${ASSUME_YES:-${LEDMATRIX_ASSUME_YES:-0}} + if [ "$ASSUME_YES" = "1" ]; then + echo "Non-interactive mode: installing required packages..." + sudo apt update + sudo apt install -y "${MISSING_PACKAGES[@]}" + echo "✓ Packages installed" + elif [ ! -t 0 ]; then + # Non-interactive mode detected (no TTY) but ASSUME_YES not set + echo "⚠ Non-interactive mode detected but ASSUME_YES not set." + echo " Installing packages automatically (required for WiFi setup)..." sudo apt update sudo apt install -y "${MISSING_PACKAGES[@]}" echo "✓ Packages installed" else - echo "⚠ Skipping package installation. WiFi setup may not work correctly." + # Interactive mode - ask user + read -p "Install these packages now? (y/N): " -n 1 -r + echo "" + if [[ $REPLY =~ ^[Yy]$ ]]; then + sudo apt update + sudo apt install -y "${MISSING_PACKAGES[@]}" + echo "✓ Packages installed" + else + echo "⚠ Skipping package installation. WiFi setup may not work correctly." + fi fi fi @@ -142,13 +160,19 @@ if [ "$WIFI_CONNECTED" = false ] && [ "$ETHERNET_CONNECTED" = false ]; then echo " 2. Or connect via Ethernet cable" echo " 3. Or proceed with installation - you can connect to LEDMatrix-Setup AP after reboot" echo "" - if [ -z "${ASSUME_YES:-}" ] && [ -z "${LEDMATRIX_ASSUME_YES:-}" ]; then + # Check for non-interactive mode (ASSUME_YES or LEDMATRIX_ASSUME_YES) + ASSUME_YES=${ASSUME_YES:-${LEDMATRIX_ASSUME_YES:-0}} + if [ "$ASSUME_YES" != "1" ] && [ -t 0 ]; then + # Interactive mode - ask user read -p "Continue with WiFi monitor installation? (y/N): " -n 1 -r echo "" if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Installation cancelled. Connect to WiFi/Ethernet and run this script again." exit 0 fi + else + # Non-interactive mode - proceed automatically + echo "Non-interactive mode: proceeding with WiFi monitor installation..." fi fi