summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-03-29 21:49:57 -0400
committerJesse Luehrs <doy@tozt.net>2018-03-30 01:32:00 -0400
commit3bb4cc428aafd8b82ce87b28165f6d3ea3ce02a2 (patch)
tree60e423f798ea728435372b0d00529503584fe5e3 /bin
parent9dd87a8cad05ee6c7a60c3d5a44e7d33d2c772ac (diff)
downloadconf-3bb4cc428aafd8b82ce87b28165f6d3ea3ce02a2.tar.gz
conf-3bb4cc428aafd8b82ce87b28165f6d3ea3ce02a2.zip
add more wifi utilities
Diffstat (limited to 'bin')
-rwxr-xr-xbin/wifi30
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/wifi b/bin/wifi
new file mode 100755
index 0000000..ccd5b04
--- /dev/null
+++ b/bin/wifi
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+DEV=wlp3s0
+OPEN=open
+
+if [ -z "$1" ]; then
+ if sudo netctl status $OPEN > /dev/null 2>&1; then
+ sudo netctl restart $OPEN
+ else
+ sudo systemctl restart netctl-auto@$DEV
+ fi
+else
+ case $1 in
+ open)
+ if ! sudo netctl status $OPEN > /dev/null 2>&1; then
+ sudo systemctl stop netctl-auto@$DEV
+ sudo netctl start $OPEN
+ fi
+ ;;
+ wpa)
+ if ! sudo systemctl status netctl-auto@$DEV > /dev/null 2>&1; then
+ sudo netctl stop $OPEN
+ sudo systemctl start netctl-auto@$DEV
+ fi
+ ;;
+ scan)
+ sudo iw dev $DEV scan | grep SSID | perl -nle 's/^.*SSID: //; print unless $seen{$_}++'
+ ;;
+ esac
+fi