2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # T2 SDE: package/.../rocknet/rocknet-getprofile
6 # Copyright (C) 2005 The T2 SDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
17 # Example for ROCKNET profile auto-detection.
19 # on default do nothing
22 # location of profile file
23 profile_file
=/etc
/conf
/network-profile
25 echo -n "Trying to auto-detect network profile .. "
26 echo default
> $profile_file
28 # we need to activate the interfaces for the test
29 ip link
set eth0 up
&> /dev
/null
30 ip link
set eth1 up
&> /dev
/null
32 # use arping to check for a well-known IPs
34 if arping
-0 -i eth0
-c3 10.0.23.42; then
35 echo foo
> $profile_file
39 # maybe we have found that essid
41 sleep 2 # give it some time to get the essid
42 if iwlist eth1 scan |
grep -q 'ESSID:"MyWLAN"'; then
43 echo bar
> $profile_file
47 # wait for all childs to finish, output found profile
48 wait; cat $profile_file
50 # deactivate the interfaces, the profile might activate them again
51 ip link
set eth0 down
&> /dev
/null
52 ip link
set eth1 down
&> /dev
/null