Made a script that connects automatically my computer to #MullvadVPN when joining a new, unknown network.
If you disconnect from the network, it disconnects from #Mullvad VPN, and if you connect to a know/trusted network, it will ignore it and won't use the VPN.
https://codeberg.org/retiolus/scripts/src/branch/main/auto-mullvad/auto-mullvad.sh
@retiolus if the script fails, where does it report?
Also: <https://www.shellcheck.net/>
$ shellcheck myscript
Line 32:
local active_connections=$(nmcli -t -f NAME,UUID con show --active | grep -v "mullvad")
^-- SC2155 (warning): Declare and assign separately to avoid masking return values.
Line 36:
local network_uuid=$(echo "$active_connections" | awk -F: '{print $2}')
^-- SC2155 (warning): Declare and assign separately to avoid masking return values.