#!/bin/sh
IPADDR="192.168.10.1"
STARTADDR="192.168.10.20"
ENDADDR="192.168.10.29"

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

case $COMMAND in
    'start')
        ifconfig $DEVNAME $IPADDR up
        hostapd /Net/hostapd-wlan.conf -B
        
        cp /Net/udhcpd-wlan.conf /Net/udhcpd.conf
        echo interface $DEVNAME >> /Net/udhcpd.conf
        echo start $STARTADDR >> /Net/udhcpd.conf
        echo end   $ENDADDR >> /Net/udhcpd.conf
        
        udhcpd /Net/udhcpd.conf
    ;;
    
    'stop')
        ifconfig $DEVNAME down
    ;;
    
    *)
        exit 1
    ;;

esac
exit 0

# EOF #
