
Tighten up with suggestions from Johannes Buchner and mention his contribution. Also fixes operation with current nmcli since it changed from "802-3-ethernet" -> "ethernet" and thus the script was broken. https://bugzilla.gnome.org/show_bug.cgi?id=513488
18 lines
499 B
Bash
Executable File
18 lines
499 B
Bash
Executable File
#!/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
|
|
|