2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: package/*/rocknet/rocknet-getprofile
4 # Copyright (C) 2005 - 2022 The T2 SDE Project
6 # This Copyright note is generated by scripts/Create-CopyPatch,
7 # more information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2.
11 # --- T2-COPYRIGHT-NOTE-END ---
14 # Example for ROCKNET profile auto-detection.
16 # on default do nothing
19 # location of profile file
20 profile_file
=/etc
/conf
/network-profile
22 echo -n "Trying to auto-detect network profile .. "
23 echo default
> $profile_file
25 # we need to activate the interfaces for the test
26 ip link
set eth0 up
&> /dev
/null
27 ip link
set eth1 up
&> /dev
/null
29 # use arping to check for a well-known IPs
31 if arping
-0 -i eth0
-c3 10.0.23.42; then
32 echo foo
> $profile_file
36 # maybe we have found that essid
38 sleep 2 # give it some time to get the essid
39 if iwlist eth1 scan |
grep -q 'ESSID:"MyWLAN"'; then
40 echo bar
> $profile_file
44 # wait for all childs to finish, output found profile
45 wait; cat $profile_file
47 # deactivate the interfaces, the profile might activate them again
48 ip link
set eth0 down
&> /dev
/null
49 ip link
set eth1 down
&> /dev
/null