#!/bin/sh # This script can be placed in any interface config directory. If it # exists and is executable, it will be executed to return target # profile name on stdout. Applicable cases to use such a script are # for example notebooks with WiFi cards. The script could invoke iwlist # to discover a WAP and decide which profile to use. When combined with # removable WiFi card, this could mean that for reconfiguring interface # for a new environment it will be enough to unplug and plug back # the card. I could imagine some other applications for this feature. # # Original idea: Alexander Bokovoy # (http://www.livejournal.com/users/abbra/4508.html?mode=reply) iw_ap_address=$(iwlist $NAME scan | fgrep Address: | cut -d: -f2-|cut -d' ' -f2) for a in $iw_ap_address do case $a in 00:00:00:00:00:00) echo f15 exit ;; 00:18:3F:99:43:E9) echo igomura exit ;; 00:13:10:86:02:0D) echo HO_North exit ;; 00:00:00:00:00:00) echo xavalon exit ;; 00:18:3F:E2:73:49) echo Slava exit ;; esac done echo disabled