#!/bin/sh
IPADDR="192.168.33.5"
SSID=test2_4G
PASS=test2_4G

DEVNAME="$1"
COMMAND="$2"

case $COMMAND in
    'start')
        wpa_passphrase $SSID $PASS > /Net/wpa_supplicant-mlan.conf
        wpa_supplicant -i $DEVNAME -D nl80211 -c /Net/wpa_supplicant-mlan.conf -B
        
        # static 
        #ifconfig $DEVNAME $IPADDR up
        
        # dhcp
        #ifconfig $DEVNAME up
        dhcpcd $DEVNAME
    ;;
    
    'stop')
        # static 
        #ifconfig $DEVNAME down
        
        # dhcp
        dhcpcd -k -d $DEVNAME
        ifconfig $DEVNAME down
    ;;
    
    *)
        exit 1
    ;;

esac
exit 0

# EOF #
