mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 21:33:00 +00:00
fix: Explicitly pass ASSUME_YES to install_wifi_monitor.sh and simplify package installation
Fix WiFi monitor installation failing at step 8.5: 1. Explicitly pass ASSUME_YES environment variable when calling install_wifi_monitor.sh from first_time_install.sh to ensure non-interactive mode is respected 2. Simplify package installation logic in install_wifi_monitor.sh: - Use apt directly when running as root (from first_time_install.sh) - Use sudo when running as regular user (direct script execution) - Always install packages automatically in non-interactive mode - Only prompt in true interactive mode (TTY available and ASSUME_YES not set) This ensures packages are installed automatically when running via one-shot installer or with -y flag, preventing installation failures at step 8.5.
This commit is contained in:
@@ -982,7 +982,8 @@ if [ -f "$PROJECT_ROOT_DIR/scripts/install/install_wifi_monitor.sh" ]; then
|
|||||||
|
|
||||||
if [ ! -f "/etc/systemd/system/ledmatrix-wifi-monitor.service" ] || [ "$NEEDS_UPDATE" = true ]; then
|
if [ ! -f "/etc/systemd/system/ledmatrix-wifi-monitor.service" ] || [ "$NEEDS_UPDATE" = true ]; then
|
||||||
echo "Installing/updating WiFi monitor service..."
|
echo "Installing/updating WiFi monitor service..."
|
||||||
bash "$PROJECT_ROOT_DIR/scripts/install/install_wifi_monitor.sh"
|
# Pass ASSUME_YES to ensure non-interactive mode
|
||||||
|
ASSUME_YES="$ASSUME_YES" LEDMATRIX_ASSUME_YES="$ASSUME_YES" bash "$PROJECT_ROOT_DIR/scripts/install/install_wifi_monitor.sh"
|
||||||
|
|
||||||
# Harden service file permissions (if service was created)
|
# Harden service file permissions (if service was created)
|
||||||
if [ -f "/etc/systemd/system/ledmatrix-wifi-monitor.service" ]; then
|
if [ -f "/etc/systemd/system/ledmatrix-wifi-monitor.service" ]; then
|
||||||
|
|||||||
@@ -47,18 +47,19 @@ if [ ${#MISSING_PACKAGES[@]} -gt 0 ]; then
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Check for non-interactive mode (ASSUME_YES or LEDMATRIX_ASSUME_YES)
|
# Check for non-interactive mode (ASSUME_YES or LEDMATRIX_ASSUME_YES)
|
||||||
|
# If called from installation script, always install packages automatically
|
||||||
ASSUME_YES=${ASSUME_YES:-${LEDMATRIX_ASSUME_YES:-0}}
|
ASSUME_YES=${ASSUME_YES:-${LEDMATRIX_ASSUME_YES:-0}}
|
||||||
if [ "$ASSUME_YES" = "1" ]; then
|
if [ "$ASSUME_YES" = "1" ] || [ ! -t 0 ]; then
|
||||||
echo "Non-interactive mode: installing required packages..."
|
# Non-interactive mode - install packages automatically
|
||||||
sudo apt update
|
# Use apt directly if running as root, otherwise use sudo
|
||||||
sudo apt install -y "${MISSING_PACKAGES[@]}"
|
echo "Installing required packages automatically..."
|
||||||
echo "✓ Packages installed"
|
if [ "$EUID" -eq 0 ]; then
|
||||||
elif [ ! -t 0 ]; then
|
apt update
|
||||||
# Non-interactive mode detected (no TTY) but ASSUME_YES not set
|
apt install -y "${MISSING_PACKAGES[@]}"
|
||||||
echo "⚠ Non-interactive mode detected but ASSUME_YES not set."
|
else
|
||||||
echo " Installing packages automatically (required for WiFi setup)..."
|
sudo apt update
|
||||||
sudo apt update
|
sudo apt install -y "${MISSING_PACKAGES[@]}"
|
||||||
sudo apt install -y "${MISSING_PACKAGES[@]}"
|
fi
|
||||||
echo "✓ Packages installed"
|
echo "✓ Packages installed"
|
||||||
else
|
else
|
||||||
# Interactive mode - ask user
|
# Interactive mode - ask user
|
||||||
|
|||||||
Reference in New Issue
Block a user