summaryrefslogtreecommitdiff
path: root/dot/local/bin/hard-restart-wifi
diff options
context:
space:
mode:
Diffstat (limited to 'dot/local/bin/hard-restart-wifi')
-rwxr-xr-xdot/local/bin/hard-restart-wifi14
1 files changed, 9 insertions, 5 deletions
diff --git a/dot/local/bin/hard-restart-wifi b/dot/local/bin/hard-restart-wifi
index 78f7144..52f21d3 100755
--- a/dot/local/bin/hard-restart-wifi
+++ b/dot/local/bin/hard-restart-wifi
@@ -10,14 +10,18 @@ with_pwd_path()
10 "$@" 10 "$@"
11} 11}
12 12
13[ $(id -u) = 0 ] || die "you are not root."
14
15restart=$(with_pwd_path which restart-linux-device) || die "command 'restart-linux-device' is not available." 13restart=$(with_pwd_path which restart-linux-device) || die "command 'restart-linux-device' is not available."
16 14
15if [ $(id -u) = 0 ]; then
16 sudo=
17else
18 sudo=sudo
19fi
20
17dev=${1:-$default_dev} 21dev=${1:-$default_dev}
18rawdev=${dev%=*} 22rawdev=${dev%=*}
19 23
20[ "$VERBOSE" ] && set -x 24[ "$VERBOSE" ] && set -x
21$restart $rawdev 25$sudo $restart $rawdev
22ifdown --force $rawdev # It's not clear to me why this is necessary, but it is. 26$sudo ifdown --force $rawdev # It's not clear to me why this is necessary, but it is.
23ifup $dev 27$sudo ifup $dev