Skip to content

Commit

Permalink
Merge pull request #1 from allanlewis/misc
Browse files Browse the repository at this point in the history
Miscellaneous fixes
  • Loading branch information
Vincent Olivert-Riera authored May 21, 2019
2 parents aca8935 + 04c3cf5 commit be40bb0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions wifi-connect
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -euo pipefail

# Read SSID
ssid=
if [ -z "${1+x}" ]; then
Expand All @@ -18,8 +20,8 @@ fi
timeout=$(( $(date +%s) + 60 ))
info=
while true; do
info=$(nmcli dev wifi list | grep "${ssid}")
if [[ ! -z "${info}" ]]; then
info=$(nmcli dev wifi list | grep "${ssid}" || true)
if [[ -n "${info}" ]]; then
break
else
current_time=$(date +%s)
Expand Down Expand Up @@ -50,7 +52,7 @@ if [[ $exit_code -eq 0 ]] ; then
echo -n "PASSWORD: " && read -r -s pass
nmcli c modify "${uuid}" wifi-sec.key-mgmt wpa-psk wifi-sec.psk "${pass}"
fi

# Activate connection
nmcli c up "${uuid}"
else
Expand Down

0 comments on commit be40bb0

Please sign in to comment.