added stage to pick out interface before anything else
This commit is contained in:
parent
14fc6dbe4e
commit
a08cd7461f
24
wifi
24
wifi
@ -2,8 +2,10 @@
|
||||
|
||||
# TODO: rid ourselves of plaintext configs which can have sensitive network keys
|
||||
|
||||
cfg_loc="/home/shockrah/.config/wifi-configs/"
|
||||
iface="wlp1s0"
|
||||
export cfg_loc="/home/shockrah/.config/wifi-configs/"
|
||||
export usb_iface='enx9cebe828e98a'
|
||||
export default_iface='wlp1s0'
|
||||
export iface=$default_iface
|
||||
debug_kill=
|
||||
|
||||
# wpa_supplicant and dhclient are only exposed to root by default
|
||||
@ -49,7 +51,7 @@ __connect_config() {
|
||||
then
|
||||
if [ ! -f "$1" ]; then
|
||||
echo Config not found
|
||||
exit 0
|
||||
exit 1
|
||||
fi
|
||||
__kill_old
|
||||
wpa_supplicant -B -i $iface -c "$1"
|
||||
@ -59,6 +61,18 @@ __connect_config() {
|
||||
fi
|
||||
}
|
||||
|
||||
select_interface() {
|
||||
_iface="`ip a \
|
||||
| awk '{print $2}' \
|
||||
| grep -E '^[a-z0-9]+:$' \
|
||||
| sed 's/://g' \
|
||||
| dmenu -i -p 'Select interface to connect on'`"
|
||||
if [ -z "$_iface" ];then
|
||||
exit 1
|
||||
fi
|
||||
iface=$_iface
|
||||
}
|
||||
|
||||
remove_old_config() {
|
||||
name="`ls $cfg_loc | dmenu -i -p 'Name of config to remove'`"
|
||||
rm -f "$cfg_loc/$name"
|
||||
@ -97,6 +111,8 @@ option=`printf "Remove\nConnect\nNew\nDiconnect\n" | dmenu -i -p 'Options:'`
|
||||
case $option in
|
||||
New) create_new_config;;
|
||||
Remove) remove_old_config;;
|
||||
Connect) reconnect_old_config;;
|
||||
Connect)
|
||||
select_interface; echo 'yes'; reconnect_old_config
|
||||
;;
|
||||
Disconnect) __kill_old;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user