blob: 46806265a7f1ee06ccd325e2e2c6da00a6d89d28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
|