diff options
Diffstat (limited to 'root/etc/NetworkManager/dispatcher.d/executable_70-auto-wifi.sh')
| -rw-r--r-- | root/etc/NetworkManager/dispatcher.d/executable_70-auto-wifi.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/root/etc/NetworkManager/dispatcher.d/executable_70-auto-wifi.sh b/root/etc/NetworkManager/dispatcher.d/executable_70-auto-wifi.sh new file mode 100644 index 0000000..4680626 --- /dev/null +++ b/root/etc/NetworkManager/dispatcher.d/executable_70-auto-wifi.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +export LANG=C + +interface="$1" +action="$2" + +connectivity="$(nmcli networking connectivity)" +interface_type="$(nmcli -g GENERAL.TYPE device show "$interface")" +interface_state="$(nmcli -g GENERAL.STATE device show "$interface" | grep -o '^[0-9]\+')" + +if [ "$action" = "down" ] && [ "$connectivity" = "none" ]; then + nmcli radio wifi on + exit +fi + +if [ "$action" = "up" ] && [ "$interface_type" == "ethernet" ] && [ "$interface_state" = "100" ]; then + nmcli radio wifi off + exit +fi + |