2021-05-11 10:37:58 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-11-27 11:04:53 -06:00
|
|
|
[ "$(pgrep -c NetworkManager)" -eq 1 ] &&
|
|
|
|
printf "NetworkManager is already running!\n" &&
|
2022-06-08 00:31:52 -05:00
|
|
|
exit
|
|
|
|
|
2021-05-11 10:37:58 -05:00
|
|
|
case $1 in
|
2022-06-08 00:31:52 -05:00
|
|
|
"c"*)
|
|
|
|
wpa_supplicant -iwlp3s0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
|
|
|
|
dhcpcd wlp3s0
|
2022-11-27 11:04:53 -06:00
|
|
|
# make tor and nohup shut up in a posix-compliant way
|
|
|
|
nohup tor >/dev/null 2>&1
|
2022-06-08 00:31:52 -05:00
|
|
|
;;
|
|
|
|
"d"*)
|
|
|
|
killall -15 wpa_supplicant dhcpcd tor
|
|
|
|
;;
|
|
|
|
"r"*)
|
2022-11-27 11:04:53 -06:00
|
|
|
sh "$0" d
|
|
|
|
sh "$0" c
|
2022-06-08 00:31:52 -05:00
|
|
|
;;
|
|
|
|
"t"*)
|
2022-11-27 11:04:53 -06:00
|
|
|
[ "$(pgrep -c wpa_supplicant)" -eq 1 ] && sh "$0" d && exit
|
|
|
|
sh "$0" c
|
2022-06-08 00:31:52 -05:00
|
|
|
;;
|
|
|
|
"l"*)
|
|
|
|
iw dev wlp3s0 scan | \
|
|
|
|
grep 'SSID\|signal' | \
|
2022-11-27 11:04:53 -06:00
|
|
|
grep -v 'SSID List' | \
|
2022-06-08 00:31:52 -05:00
|
|
|
awk -F': ' '{print $2}' | \
|
|
|
|
sed 'N;s/\n/ /' | \
|
|
|
|
grep -v '\x00'
|
|
|
|
;;
|
|
|
|
*)
|
2022-11-27 11:04:53 -06:00
|
|
|
echo "
|
2021-05-11 10:37:58 -05:00
|
|
|
simple wrapper for connecting to a network
|
2021-05-11 22:02:41 -05:00
|
|
|
${0} toggle to toggle wifi connection
|
2021-05-11 10:37:58 -05:00
|
|
|
${0} restart to restart wifi
|
|
|
|
${0} disconnect to disconnect
|
|
|
|
${0} connect to connect to network
|
2021-06-20 17:15:09 -05:00
|
|
|
${0} list to list networks
|
2021-05-11 10:37:58 -05:00
|
|
|
"
|
2022-06-08 00:31:52 -05:00
|
|
|
;;
|
2021-05-11 11:12:23 -05:00
|
|
|
esac
|
2021-05-11 10:37:58 -05:00
|
|
|
exit 0
|