You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							53 lines
						
					
					
						
							1.4 KiB
						
					
					
				
			
		
		
	
	
							53 lines
						
					
					
						
							1.4 KiB
						
					
					
				| #!/bin/bash | |
| # --- SDE-COPYRIGHT-NOTE-BEGIN --- | |
| # This copyright note is auto-generated by ./scripts/Create-CopyPatch. | |
| # | |
| # Filename: package/.../rocknet/rocknet-getprofile | |
| # Copyright (C) 2005 - 2006 The T2 SDE Project | |
| # | |
| # More information can be found in the files COPYING and README. | |
| # | |
| # 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; version 2 of the License. A copy of the | |
| # GNU General Public License can be found in the file COPYING. | |
| # --- SDE-COPYRIGHT-NOTE-END --- | |
|  | |
| # | |
| # Example for ROCKNET profile auto-detection. | |
|  | |
| # on default do nothing | |
| exit 0 | |
|  | |
| # location of profile file | |
| profile_file=/etc/conf/network-profile | |
|  | |
| echo -n "Trying to auto-detect network profile .. " | |
| echo default > $profile_file | |
|  | |
| # we need to activate the interfaces for the test | |
| ip link set eth0 up &> /dev/null | |
| ip link set eth1 up &> /dev/null | |
|  | |
| # use arping to check for a well-known IPs | |
| ( | |
| 	if arping -0 -i eth0 -c3 10.0.23.42; then | |
| 		echo foo > $profile_file | |
| 	fi | |
| ) &> /dev/null & | |
|  | |
| # maybe we have found that essid | |
| ( | |
| 	sleep 2 # give it some time to get the essid | |
| 	if iwlist eth1 scan | grep -q 'ESSID:"MyWLAN"'; then | |
| 		echo bar > $profile_file | |
| 	fi | |
| ) &> /dev/null & | |
|  | |
| # wait for all childs to finish, output found profile | |
| wait; cat $profile_file | |
|  | |
| # deactivate the interfaces, the profile might activate them again | |
| ip link set eth0 down &> /dev/null | |
| ip link set eth1 down &> /dev/null | |
| 
 | |
| 
 |