summaryrefslogtreecommitdiff
path: root/examples/dispatcher/70-wifi-wired-exclusive.sh
blob: fac18b59dd0915876e9aa964b9d302c796e8eefe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# This dispatcher script makes Wi-Fi mutually exclusive with
# wired networking.  When a wired interface is connected,
# Wi-Fi will be set to airplane mode (rfkilled).  When the wired
# interface is disconnected, Wi-Fi will be turned back on.
#
# Copyright 2012 Johannes Buchner <buchner.johannes@gmx.at>
# Copyright 2012 - 2014 Red Hat, Inc.
#

export LC_ALL=C
if nmcli -t --fields type,state dev | grep -E "ethernet:connected" -q; then
	nmcli radio wifi off
else
	nmcli radio wifi on
fi