blob: 52f21d3f7ec8d280f6309380444d0553e8171128 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/sh
default_dev='wlan0=funston'
die() { printf 'Error: %s\n' "$*" >&2; exit 1; }
with_pwd_path()
{
local PATH="$PATH":.
"$@"
}
restart=$(with_pwd_path which restart-linux-device) || die "command 'restart-linux-device' is not available."
if [ $(id -u) = 0 ]; then
sudo=
else
sudo=sudo
fi
dev=${1:-$default_dev}
rawdev=${dev%=*}
[ "$VERBOSE" ] && set -x
$sudo $restart $rawdev
$sudo ifdown --force $rawdev # It's not clear to me why this is necessary, but it is.
$sudo ifup $dev
|