-
Notifications
You must be signed in to change notification settings - Fork 9
/
user-callback.ssid
40 lines (35 loc) · 1.33 KB
/
user-callback.ssid
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
35
36
37
38
39
40
#!/bin/bash
# Copyright (c) 2012-2016 Germar Reitze
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#This script will check if you're connected to the correct WLAN (based on SSID)
#In this example it will break new snapshots for profile 1 if not in 'HOME_WLAN'
#and for profile 2 if not in 'WLAN_AT_WORK'
profile_id="$1"
profile_name="$2"
reason="$3"
check_ssid() {
if [ $(iwconfig 2>/dev/null | grep -c "ESSID:\"$1\"") -eq 0 ]; then
return 1
fi
}
case $reason in
1) #Backup process begins
case $profile_id in
1) check_ssid "HOME_WLAN"; exit $?;;
2) check_ssid "WLAN_AT_WORK"; exit $?;;
esac
;;
esac