jank as hell but it works lmao

This commit is contained in:
shockrahwow 2019-08-30 13:14:00 -07:00
parent 4547825e03
commit 1212d4968b

16
wifi
View File

@ -2,7 +2,7 @@
# TODO: rid ourselves of plaintext configs which can have sensitive network keys
cfg_loc="$HOME/.config/wifi-configs/"
cfg_loc="/home/shockrah/.config/wifi-configs/"
iface="wlp1s0"
# wpa_supplicant and dhclient are only exposed to root by default
@ -38,7 +38,9 @@ printf "network={
__kill_old() {
if [ -z "$debug_kill" ]
then
kill `pgrep wpa`
echo killing old process
kill "`pgrep wpa_supplicant`"
echo releasing leases
dhclient -r
else
echo 'Not killing anything'
@ -49,10 +51,13 @@ __connect_config() {
if [ -z "$debug_kill" ]
then
__kill_old
wpa_supplicant -B -i wlp1s0 -c /etc/wpa_supplicant.conf -D wext
echo Seriously this is going to take a minute
echo Setting up wpa_supplicant
wpa_supplicant -B -i wlp1s0 -c "$1"
echo Attempting dhclient
dhclient wlp1s0
else
echo 'No restart'
echo Not connecting to anything
fi
}
@ -65,8 +70,7 @@ reconnect_old_config() {
name="`ls $cfg_loc | dmenu -i -p 'Choose config to connect with'`"
if [ ! -z "$name" ]
then
__kill_old
__connect_config
__connect_config "$cfg_loc/$name"
fi
}