-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwifi
More file actions
executable file
·34 lines (26 loc) · 714 Bytes
/
wifi
File metadata and controls
executable file
·34 lines (26 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# WIFI
# list wifi profiles: `netctl list`
# export DOT_LOG=true
# Imports:
source $TOOLS/dot-log
source $TOOLS/dot-color
#nmcli device wifi connect $WIFI_NAME FBI UPS Truck" password $WIFI_PASSWORD
function connected() {
wget -q --spider http://google.com
[[ $? == 0 ]] && echo true || echo false
}
function connect() {
sudo ip link set $WIFI_DEVICE down
sudo netctl stop $WIFI_PROFILE
sudo netctl start $WIFI_PROFILE
}
function main() {
connect
if [[ ! connected ]]; then
notify-send --urgency critical "dot-wifi" "Failed to connect to wifi: $WIFI_PROFILE"
exit 1
fi
notify-send "dot-wifi" "Connected to wifi: $WIFI_PROFILE"
}
main