#!/bin/sh

. /etc/utils/shell-utils.sh
DEBUG=1

#set -e
echo "Executing >>> $0 <<<"; echo

case "$1" in
  start)
    echo -n "Starting network..."
    log "Starting network..."
    
    ifup lo
    ifup eth0
#    ifup wlan0

    echo "Done."
    log "Done."
  ;;

  restart)
    echo -n "Restarting NETWORK..."
    log "Restarting NETWORK..."

    /etc/init.d/rc.network stop
    sleep 1
    /etc/init.d/rc.network start

    echo "Done."
    log "Done."
  ;;

  stop)
    echo -n "Stopping NETWORK..."
    log "Stopping NETWORK..."

    ifdown eth0
#    ifdown wlan0

    echo "Done."
    log "Done."
  ;;

  *)
    echo "Usage: /etc/init.d/udhcpc {start|stop|restart}"
    log "Usage: /etc/init.d/udhcpc {start|stop|restart}"
    exit 1
    ;;
esac

exit 0
