add exception for systems using networkmanager

This commit is contained in:
randomuser 2022-06-08 00:31:52 -05:00
parent 7cd0e131ff
commit 3751a7d125
1 changed files with 31 additions and 27 deletions

View File

@ -1,32 +1,36 @@
#!/bin/sh #!/bin/sh
[ "$(ps -aux | grep -c NetworkManager)" -eq 2 ] && \
printf "NetworkManager is already running!" && \
exit
case $1 in case $1 in
"c"*) "c"*)
wpa_supplicant -iwlp3s0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B wpa_supplicant -iwlp3s0 -c/etc/wpa_supplicant/wpa_supplicant.conf -B
dhcpcd wlp3s0 dhcpcd wlp3s0
tor & disown tor & disown
;; ;;
"d"*) "d"*)
killall -15 wpa_supplicant dhcpcd tor killall -15 wpa_supplicant dhcpcd tor
;; ;;
"r"*) "r"*)
sh $0 d sh $0 d
sh $0 c sh $0 c
;; ;;
"t"*) "t"*)
[ $(ps aux | grep wpa_supplicant | wc -l) -eq 2 ] && sh $0 d && exit [ $(ps aux | grep wpa_supplicant | wc -l) -eq 2 ] && sh $0 d && exit
sh $0 c sh $0 c
;; ;;
"l"*) "l"*)
iw dev wlp3s0 scan | \ iw dev wlp3s0 scan | \
grep 'SSID\|signal' | \ grep 'SSID\|signal' | \
grep -v '* SSID List' | \ grep -v '* SSID List' | \
awk -F': ' '{print $2}' | \ awk -F': ' '{print $2}' | \
sed 'N;s/\n/ /' | \ sed 'N;s/\n/ /' | \
grep -v '\x00' grep -v '\x00'
;; ;;
*) *)
printf "\ printf "\
simple wrapper for connecting to a network simple wrapper for connecting to a network
${0} toggle to toggle wifi connection ${0} toggle to toggle wifi connection
${0} restart to restart wifi ${0} restart to restart wifi
@ -34,6 +38,6 @@ ${0} disconnect to disconnect
${0} connect to connect to network ${0} connect to connect to network
${0} list to list networks ${0} list to list networks
" "
;; ;;
esac esac
exit 0 exit 0