set -e

#Ensure the correct values are received by the script
if [ -z "$1" ] || [ -z "$2" ] ; then
echo "Wrong arguments for ifplugd" > /dev/stderr
fi

if [ "$2" = "up" ]
then
echo "ifplugd up"
ifup $1
/sbin/udhcpc -D -s /usr/share/udhcpc/default.script
fi

if [ "$2" = "down" ]
then
echo "ifplugd down"
ifdown $1
#/sbin/ifconfig $1 down
fi
