File: 70-wifi-wired-exclusive.sh

package info (click to toggle)
network-manager 1.52.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 71,048 kB
  • sloc: ansic: 480,022; python: 11,394; xml: 8,504; sh: 5,535; perl: 596; cpp: 178; javascript: 130; ruby: 107; makefile: 57; lisp: 22
file content (17 lines) | stat: -rwxr-xr-x 510 bytes parent folder | download | duplicates (5)
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 (C) 2012 Johannes Buchner <buchner.johannes@gmx.at>
# Copyright (C) 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