diff --git a/install.sh b/install.sh index 696db6e..c5a1189 100644 --- a/install.sh +++ b/install.sh @@ -5,33 +5,14 @@ REPO_URL="https://gitea.moto-adv.com/ske087/signage-player.git" # Replace with PROJECT_DIR="/home/pi/Desktop/ds-player" # Full path to the installation folder VENV_DIR="$PROJECT_DIR/venv" # Path to the virtual environment SERVICE_NAME="ds-player.service" -WIFI_SSID="CosaNostra" # Replace with your Wi-Fi SSID -WIFI_PASSWORD="Leonardo" # Replace with your Wi-Fi password -# Step 0: Check if Wi-Fi is enabled and connect to Wi-Fi -echo "Checking if Wi-Fi is enabled..." -if ! rfkill list wifi | grep -q "Soft blocked: no"; then - echo "Wi-Fi is disabled. Enabling Wi-Fi..." - rfkill unblock wifi - sleep 5 +# Step 0: Check if an internet connection exists +echo "Checking internet connection..." +if ! ping -c 1 google.com &> /dev/null; then + echo "No internet connection detected. Please ensure the device is connected to the internet." + exit 1 else - echo "Wi-Fi is already enabled." -fi - -echo "Checking Wi-Fi connection..." -if ! iwgetid -r > /dev/null; then - echo "Not connected to Wi-Fi. Connecting to $WIFI_SSID..." - sudo bash -c "wpa_passphrase \"$WIFI_SSID\" \"$WIFI_PASSWORD\" > /etc/wpa_supplicant/wpa_supplicant.conf" - sudo wpa_cli -i wlan0 reconfigure - sleep 10 - if iwgetid -r > /dev/null; then - echo "Successfully connected to Wi-Fi: $WIFI_SSID" - else - echo "Failed to connect to Wi-Fi. Please check your credentials." - exit 1 - fi -else - echo "Already connected to Wi-Fi: $(iwgetid -r)" + echo "Internet connection is active." fi # Step 1: Check if the installation folder exists