#!/bin/sh
#### help
# * If you use Static IP
#IPADDR="xxx.xxx.xxx.xxx"
# * If you use DHCP
#IPADDR=

IPADDR="192.168.50.1"

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

case $COMMAND in
    'start')
        ifconfig $DEVNAME $IPADDR up
        if [ "${IPADDR}" == "" ] ; then
            dhcpcd $DEVNAME
        fi
    ;;
    
    'stop')
        if [ "${IPADDR}" == "" ] ; then
            dhcpcd -k -d $DEVNAME
        fi
        ifconfig $DEVNAME down
    ;;
    
    *)
        exit 1
    ;;

esac
exit 0

# EOF #
