about summary refs log tree commit diff
path: root/examples/dispatcher/70-wifi-wired-exclusive.sh
blob: 676695f443252f740e18a666450a73e3bbcfd391 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# This dispatcher script makes WiFi mutually exclusive with
# wired networking.  When a wired interface is connected,
# WiFi will be set to airplane mode (rfkilled).  When the wired
# interface is disconnected, WiFi 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