mirror of https://github.com/OpenIPC/firmware.git
				
				
				
			
		
			
				
	
	
		
			29 lines
		
	
	
		
			653 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			29 lines
		
	
	
		
			653 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
| #!/bin/sh
 | |
| SSID=OpenIPC
 | |
| PASS=12345678
 | |
| MODE=server
 | |
| 
 | |
| if [ $1 = "connect" ]; then
 | |
| 	wpa_passphrase $SSID $PASS > /tmp/wpa_supplicant.conf
 | |
| 	if [ $MODE = "client" ]; then
 | |
| 		sed -i '2i \\tscan_ssid=1' /tmp/wpa_supplicant.conf
 | |
| 	else
 | |
| 		sed -i '2i \\tmode=2' /tmp/wpa_supplicant.conf
 | |
| 	fi
 | |
| 	wpa_supplicant -B -D nl80211 -i wlan0 -c /tmp/wpa_supplicant.conf
 | |
| 	if [ $MODE = "server" ]; then
 | |
| 		udhcpd && sleep 300 && killall -q udhcpd && killall -q wpa_supplicant &
 | |
| 	fi
 | |
| fi
 | |
| 
 | |
| if [ $1 = "startup" ]; then
 | |
| 	/etc/wireless/netadapter $1
 | |
| 	ifconfig eth0 192.168.2.10
 | |
| fi
 | |
| 
 | |
| if [ $1 = "shutdown" ]; then
 | |
| 	killall -q udhcpd
 | |
| 	killall -q wpa_supplicant
 | |
| 	/etc/wireless/netadapter $1
 | |
| fi
 |