2012-09-26 03:10:42 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# If we are running NetworkManager, tell it we are going to sleep.
|
|
|
|
|
|
|
|
. "${PM_FUNCTIONS}"
|
|
|
|
|
|
|
|
suspend_nm()
|
|
|
|
{
|
|
|
|
# Tell NetworkManager to shut down networking
|
|
|
|
printf "Having NetworkManager put all interaces to sleep..."
|
2016-06-30 22:26:57 +02:00
|
|
|
dbus_send --system --print-reply \
|
2012-09-26 03:10:42 +02:00
|
|
|
--dest=org.freedesktop.NetworkManager \
|
|
|
|
/org/freedesktop/NetworkManager \
|
2016-06-30 22:26:57 +02:00
|
|
|
org.freedesktop.NetworkManager.Sleep \
|
|
|
|
boolean:true && \
|
2012-09-26 03:10:42 +02:00
|
|
|
echo Done. || echo Failed.
|
|
|
|
}
|
|
|
|
|
|
|
|
resume_nm()
|
|
|
|
{
|
|
|
|
# Wake up NetworkManager and make it do a new connection
|
|
|
|
printf "Having NetworkManager wake interfaces back up..."
|
2016-06-30 22:26:57 +02:00
|
|
|
dbus_send --system --print-reply \
|
2012-09-26 03:10:42 +02:00
|
|
|
--dest=org.freedesktop.NetworkManager \
|
|
|
|
/org/freedesktop/NetworkManager \
|
2016-06-30 22:26:57 +02:00
|
|
|
org.freedesktop.NetworkManager.Sleep \
|
|
|
|
boolean:false && \
|
2012-09-26 03:10:42 +02:00
|
|
|
echo Done. || echo Failed.
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
hibernate|suspend)
|
|
|
|
suspend_nm
|
|
|
|
;;
|
|
|
|
thaw|resume)
|
|
|
|
resume_nm
|
|
|
|
;;
|
|
|
|
*) exit $NA
|
|
|
|
;;
|
|
|
|
esac
|