core-agent-linux/qubes_rpc/prepare-suspend
Marek Marczykowski bec4afc919 vm: export SuspendPre and SuspendPost qrexec services (#617)
1. Try to use NetworkManager sleep command instead of shutting it down
2. Move sleep action details (which is VM-specific) to VM
3. Export it as qrexec service(s)
2012-07-13 14:44:11 +02:00

17 lines
521 B
Bash
Executable File

#!/bin/sh
action=$1
[ -z "$action" ] && action=suspend
if [ x"$action" == x"suspend" ]; then
nmcli nm sleep true || service NetworkManager stop
# Force interfaces down, just in case when NM didn't done it
for if in `ls /sys/class/net|grep -v "lo\|vif"`; do
ip l s $if down
done
modprobe -r uhci_hcd ehci_hcd
else
modprobe ehci_hcd; modprobe uhci_hcd;
nmcli nm sleep false || { [ -x /bin/systemctl ] && systemctl start NetworkManager.service; } || service qubes_core_netvm start
fi