-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrwif
executable file
·60 lines (52 loc) · 1.38 KB
/
rwif
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Copyright(c) 2012 RubytotheRails.com
# This is free software distributed per the MIT License at www.r2dr.com/licenses/commands
# Copyright and License URL must be included for any distribution
RWIF_VERSION=1.3
DIR=~/.rwif
mkdir $DIR 2> /dev/null
function paint { echo $2; }
function colorOn { echo -n; }
function colorOff { echo -n; }
[[ -f $(dirname $0)/colorize ]] && source "$(dirname $0)/colorize"
function usage {
echo "Reset wifi utility"
echo "rwif [OPTIONS]"
echo ""
echo " -q, --quiet no output"
echo " -h, --help"
echo " --version"
echo ""
}
QUIET=
VERBOSE=
case $1 in
-h|--help) colorOn yellow; usage; colorOff; exit ;;
-q|--quiet) QUIET=y; VERBOSE= ;;
-v|--verbose) QUIET=; VERBOSE=y ;;
--version) echo $RWIF_VERSION; exit ;;
esac
type wmod >/dev/null 2>&1 || { echo "Cannot proceed: 'wmod' command is required and not available."; echo ""; exit 1; }
DRIVER=`wmod`
if [[ -z $DRIVER ]]; then
if [[ -z $QUIET ]]; then
paint orange "Wireless driver module not identified"
echo
fi
exit 1
fi
if [[ $VERBOSE ]]; then
sudo killall nm-applet
sudo modprobe -v -r $DRIVER
sudo modprobe -v $DRIVER
nohup nm-applet >$DIR/nohup.out 2>&1 &
else
sudo killall nm-applet 2>/dev/null
sudo modprobe -r $DRIVER
sudo modprobe $DRIVER
nohup nm-applet >$DIR/nohup.out 2>/dev/null &
fi
if [[ -z $QUIET ]]; then
echo "reloading $DRIVER wlan module"
echo ""
fi