mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 05:13:01 +00:00
refactor: Remove all prompts from install_wifi_monitor.sh - install packages automatically
Simplify WiFi monitor installation by removing all user prompts: 1. Package installation: Always install required packages automatically - No prompt for missing packages (hostapd, dnsmasq, network-manager) - Just install them if missing 2. Network connection warning: Remove prompt to continue - Just display informational message and proceed - WiFi monitor will handle AP mode automatically if no network 3. Remove ASSUME_YES environment variable passing from first_time_install.sh - No longer needed since script has no prompts This makes the installation completely non-interactive and simpler, preventing any hangs or failures at step 8.5.
This commit is contained in:
@@ -40,39 +40,22 @@ if ! command -v nmcli >/dev/null 2>&1 && ! command -v iwlist >/dev/null 2>&1; th
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${#MISSING_PACKAGES[@]} -gt 0 ]; then
|
if [ ${#MISSING_PACKAGES[@]} -gt 0 ]; then
|
||||||
echo "⚠ The following packages are required for WiFi setup:"
|
echo "Installing required packages for WiFi setup:"
|
||||||
for pkg in "${MISSING_PACKAGES[@]}"; do
|
for pkg in "${MISSING_PACKAGES[@]}"; do
|
||||||
echo " - $pkg"
|
echo " - $pkg"
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Check for non-interactive mode (ASSUME_YES or LEDMATRIX_ASSUME_YES)
|
# Install packages automatically (no prompt)
|
||||||
# If called from installation script, always install packages automatically
|
# Use apt directly if running as root, otherwise use sudo
|
||||||
ASSUME_YES=${ASSUME_YES:-${LEDMATRIX_ASSUME_YES:-0}}
|
if [ "$EUID" -eq 0 ]; then
|
||||||
if [ "$ASSUME_YES" = "1" ] || [ ! -t 0 ]; then
|
apt update
|
||||||
# Non-interactive mode - install packages automatically
|
apt install -y "${MISSING_PACKAGES[@]}"
|
||||||
# Use apt directly if running as root, otherwise use sudo
|
|
||||||
echo "Installing required packages automatically..."
|
|
||||||
if [ "$EUID" -eq 0 ]; then
|
|
||||||
apt update
|
|
||||||
apt install -y "${MISSING_PACKAGES[@]}"
|
|
||||||
else
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y "${MISSING_PACKAGES[@]}"
|
|
||||||
fi
|
|
||||||
echo "✓ Packages installed"
|
|
||||||
else
|
else
|
||||||
# Interactive mode - ask user
|
sudo apt update
|
||||||
read -p "Install these packages now? (y/N): " -n 1 -r
|
sudo apt install -y "${MISSING_PACKAGES[@]}"
|
||||||
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
|
||||||
|
echo "✓ Packages installed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create service file with correct paths
|
# Create service file with correct paths
|
||||||
@@ -161,20 +144,8 @@ if [ "$WIFI_CONNECTED" = false ] && [ "$ETHERNET_CONNECTED" = false ]; then
|
|||||||
echo " 2. Or connect via Ethernet cable"
|
echo " 2. Or connect via Ethernet cable"
|
||||||
echo " 3. Or proceed with installation - you can connect to LEDMatrix-Setup AP after reboot"
|
echo " 3. Or proceed with installation - you can connect to LEDMatrix-Setup AP after reboot"
|
||||||
echo ""
|
echo ""
|
||||||
# Check for non-interactive mode (ASSUME_YES or LEDMATRIX_ASSUME_YES)
|
echo "Proceeding with WiFi monitor installation..."
|
||||||
ASSUME_YES=${ASSUME_YES:-${LEDMATRIX_ASSUME_YES:-0}}
|
echo " (WiFi monitor will enable AP mode if no network connection is detected)"
|
||||||
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
|
fi
|
||||||
|
|
||||||
# Reload systemd
|
# Reload systemd
|
||||||
|
|||||||
Reference in New Issue
Block a user