#!/bin/sh -e
# Restart network around suspend/resume.
# suspend,resume: 40,60

[ -x /etc/init.d/network ] || exit 0

lock=/var/run/apm/network

case "$1,$2" in
	suspend,*)
		if [ -f /var/lock/subsys/network ]; then
			service network stop
			touch "$lock"
		else
			rm -f "$lock"
		fi
		;;
	resume,suspend)
		if [ -f "$lock" ]; then
			rm -f "$lock"
			service network start
		fi
		;;
esac

exit 0
