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)
This commit is contained in:
Marek Marczykowski 2012-07-13 14:40:52 +02:00
parent 3af500fc80
commit bec4afc919
4 changed files with 23 additions and 0 deletions

16
qubes_rpc/prepare-suspend Executable file
View File

@ -0,0 +1,16 @@
#!/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

View File

@ -0,0 +1 @@
/usr/lib/qubes/prepare-suspend resume

View File

@ -0,0 +1 @@
/usr/lib/qubes/prepare-suspend suspend

View File

@ -158,10 +158,12 @@ install qubes_rpc/qvm-copy-to-vm.gnome $RPM_BUILD_ROOT/usr/lib/qubes
install qubes_rpc/{vm-file-editor,qfile-agent,qopen-in-vm,qfile-unpacker} $RPM_BUILD_ROOT/usr/lib/qubes
install qubes_rpc/{vm-shell,qrun-in-vm} $RPM_BUILD_ROOT/usr/lib/qubes
install qubes_rpc/sync-ntp-clock $RPM_BUILD_ROOT/usr/lib/qubes
install qubes_rpc/prepare-suspend $RPM_BUILD_ROOT/usr/lib/qubes
install -d $RPM_BUILD_ROOT/%{kde_service_dir}
install -m 0644 qubes_rpc/{qvm-copy.desktop,qvm-dvm.desktop} $RPM_BUILD_ROOT/%{kde_service_dir}
install -d $RPM_BUILD_ROOT/etc/qubes_rpc
install -m 0644 qubes_rpc/{qubes.Filecopy,qubes.OpenInVM,qubes.VMShell,qubes.SyncNtpClock} $RPM_BUILD_ROOT/etc/qubes_rpc
install -m 0644 qubes_rpc/{qubes.SuspendPre,qubes.SuspendPost} $RPM_BUILD_ROOT/etc/qubes_rpc
install qrexec/qrexec_agent $RPM_BUILD_ROOT/usr/lib/qubes
install qrexec/qrexec_client_vm $RPM_BUILD_ROOT/usr/lib/qubes
@ -371,6 +373,8 @@ rm -rf $RPM_BUILD_ROOT
/etc/qubes_rpc/qubes.OpenInVM
/etc/qubes_rpc/qubes.VMShell
/etc/qubes_rpc/qubes.SyncNtpClock
/etc/qubes_rpc/qubes.SuspendPre
/etc/qubes_rpc/qubes.SuspendPost
/etc/sudoers.d/qubes
/etc/sysconfig/iptables
/etc/sysconfig/modules/qubes_core.modules
@ -396,6 +400,7 @@ rm -rf $RPM_BUILD_ROOT
/usr/lib/qubes/block_remove
/usr/lib/qubes/dispvm-prerun.sh
/usr/lib/qubes/sync-ntp-clock
/usr/lib/qubes/prepare-suspend
/usr/lib/qubes/meminfo-writer
/usr/lib/qubes/network-manager-prepare-conf-dir
/usr/lib/qubes/qfile-agent