jank as hell but it works lmao
This commit is contained in:
parent
4547825e03
commit
1212d4968b
16
wifi
16
wifi
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# TODO: rid ourselves of plaintext configs which can have sensitive network keys
|
# 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"
|
iface="wlp1s0"
|
||||||
|
|
||||||
# wpa_supplicant and dhclient are only exposed to root by default
|
# wpa_supplicant and dhclient are only exposed to root by default
|
||||||
@ -38,7 +38,9 @@ printf "network={
|
|||||||
__kill_old() {
|
__kill_old() {
|
||||||
if [ -z "$debug_kill" ]
|
if [ -z "$debug_kill" ]
|
||||||
then
|
then
|
||||||
kill `pgrep wpa`
|
echo killing old process
|
||||||
|
kill "`pgrep wpa_supplicant`"
|
||||||
|
echo releasing leases
|
||||||
dhclient -r
|
dhclient -r
|
||||||
else
|
else
|
||||||
echo 'Not killing anything'
|
echo 'Not killing anything'
|
||||||
@ -49,10 +51,13 @@ __connect_config() {
|
|||||||
if [ -z "$debug_kill" ]
|
if [ -z "$debug_kill" ]
|
||||||
then
|
then
|
||||||
__kill_old
|
__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
|
dhclient wlp1s0
|
||||||
else
|
else
|
||||||
echo 'No restart'
|
echo Not connecting to anything
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,8 +70,7 @@ reconnect_old_config() {
|
|||||||
name="`ls $cfg_loc | dmenu -i -p 'Choose config to connect with'`"
|
name="`ls $cfg_loc | dmenu -i -p 'Choose config to connect with'`"
|
||||||
if [ ! -z "$name" ]
|
if [ ! -z "$name" ]
|
||||||
then
|
then
|
||||||
__kill_old
|
__connect_config "$cfg_loc/$name"
|
||||||
__connect_config
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user