Navigation Menu

Skip to content

Commit

Permalink
use the previously stored password if no correct password is entered
Browse files Browse the repository at this point in the history
  • Loading branch information
l29ah committed May 27, 2015
1 parent b03a3ed commit b0e809b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sbin/wifi-select
Expand Up @@ -36,7 +36,12 @@ ESSID=$(dialog --menu "Choose network" 20 80 15 "${a[@]}" 2>&1 1>&3) || default
[ -n "$ESSID" ] || fail
if [[ "${keytype[$ESSID]}" == "on" ]]; then
passphrase=$(dialog --passwordbox "Enter password for $ESSID" 20 80 2>&1 1>&3)
res=$(wpa_passphrase "$ESSID" "$passphrase") || fail "$res"
res=$(wpa_passphrase "$ESSID" "$passphrase") || {
e="$res; trying to connect anyway"
res="`perl -0777 -n -e 's/.*\n(network={\n.*?ssid="'"$ESSID"'".*?})/$1/ms and print' < "${conf}.default"`"
run
fail "$e"
}
else
res="
network={
Expand All @@ -48,4 +53,5 @@ fi
echo "$res"
cat "${conf}.template" > "$conf"
echo "$res" >> "$conf"
echo "$res" >> "${conf}.default"
run

0 comments on commit b0e809b

Please sign in to comment.