firmware/general/package/wireless-configuration/files/netsetup

29 lines
644 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/network/netadapter $1
ifconfig eth0 192.168.2.10
ifup wlan0
fi
if [ $1 = "shutdown" ]; then
killall -q wpa_supplicant
/etc/network/netadapter $1
fi