diff --git a/setup.sh b/setup.sh index 9a85c3b..9523e4c 100644 --- a/setup.sh +++ b/setup.sh @@ -172,66 +172,24 @@ fi # Configure static IP for wlan0 using NetworkManager (nmcli) echo "Configuring static IP for wlan0 using NetworkManager..." -# Check if a connection for wlan0 already exists and delete it to start fresh -if nmcli -t -f NAME,DEVICE c show --active | grep -q "wlan0"; then - ACTIVE_CON=$(nmcli -t -f NAME,DEVICE c show --active | grep "wlan0" | cut -d':' -f1) - echo "Temporarily deactivating existing connection on wlan0: $ACTIVE_CON" - sudo nmcli c down "$ACTIVE_CON" || true + +# Define the connection name +CON_NAME="TimeTurner-AP" + +# If a connection with this name already exists, delete it to ensure a clean slate. +if nmcli c show --active | grep -q "$CON_NAME"; then + sudo nmcli c down "$CON_NAME" || true +fi +if nmcli c show | grep -q "$CON_NAME"; then + echo "Deleting existing '$CON_NAME' connection profile..." + sudo nmcli c delete "$CON_NAME" || true fi -# Create a new connection profile for the AP -# This sets the static IP and configures it to not manage this interface for other connections. -sudo tee /etc/NetworkManager/conf.d/99-unmanaged-wlan0.conf > /dev/null < /dev/null <