#!/bin/sh
# suspend ifplugd

[ -f /etc/default/ifplugd ] || exit 0
. /etc/default/ifplugd
[ "$SUSPEND_ACTION" ] || [ "$SUSPEND_ACTION" != "none" ] || exit 0

if [ "$SUSPEND_ACTION" = "suspend" ] ; then
  RESUME_ACTION="resume"
elif [ "$SUSPEND_ACTION" = "stop" ] ; then
  RESUME_ACTION="start"
else
  exit 0
fi

if [ "$1" = suspend ]; then
    /etc/init.d/ifplugd ${SUSPEND_ACTION}
elif [ "$1" = resume ] && [ "$2" != standby ]; then
    /etc/init.d/ifplugd ${RESUME_ACTION}
fi

exit 0
