diff options
Diffstat (limited to 'dot/local/bin/hard-restart-wifi')
-rwxr-xr-x | dot/local/bin/hard-restart-wifi | 14 |
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 | |||
15 | restart=$(with_pwd_path which restart-linux-device) || die "command 'restart-linux-device' is not available." | 13 | restart=$(with_pwd_path which restart-linux-device) || die "command 'restart-linux-device' is not available." |
16 | 14 | ||
15 | if [ $(id -u) = 0 ]; then | ||
16 | sudo= | ||
17 | else | ||
18 | sudo=sudo | ||
19 | fi | ||
20 | |||
17 | dev=${1:-$default_dev} | 21 | dev=${1:-$default_dev} |
18 | rawdev=${dev%=*} | 22 | rawdev=${dev%=*} |
19 | 23 | ||
20 | [ "$VERBOSE" ] && set -x | 24 | [ "$VERBOSE" ] && set -x |
21 | $restart $rawdev | 25 | $sudo $restart $rawdev |
22 | ifdown --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. |
23 | ifup $dev | 27 | $sudo ifup $dev |