diff options
author | Jesse Luehrs <doy@tozt.net> | 2018-10-18 14:10:00 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-10-18 14:10:12 -0400 |
commit | 78a6a52b61b53eeaa6e13074897917b6329b468c (patch) | |
tree | 893e9ed2abf675c85c1f19cbb32744c25d2050b7 | |
parent | ed4dcb998d6a856b17c966fb9c93d14b688621db (diff) | |
download | conf-78a6a52b61b53eeaa6e13074897917b6329b468c.tar.gz conf-78a6a52b61b53eeaa6e13074897917b6329b468c.zip |
improvements to my wifi script
-rwxr-xr-x | bin/wifi | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,4 +1,6 @@ #!/bin/sh +set -eu +set -o pipefail DEV=wlp3s0 OPEN=open @@ -12,7 +14,13 @@ if [ -z "$1" ]; then else case $1 in open) - if ! sudo netctl status $OPEN > /dev/null 2>&1; then + if [ -n "$2" ]; then + sudo sed -i "s/^ESSID=.*/ESSID='${2}'/" "/etc/netctl/${OPEN}" + fi + + if sudo netctl status $OPEN > /dev/null 2>&1; then + sudo netctl restart $OPEN + else sudo systemctl stop netctl-auto@$DEV sudo netctl start $OPEN fi |