diff --git a/qubes_rpc/prepare-suspend b/qubes_rpc/prepare-suspend new file mode 100755 index 0000000..4df1122 --- /dev/null +++ b/qubes_rpc/prepare-suspend @@ -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 diff --git a/qubes_rpc/qubes.SuspendPost b/qubes_rpc/qubes.SuspendPost new file mode 100644 index 0000000..73bf2ea --- /dev/null +++ b/qubes_rpc/qubes.SuspendPost @@ -0,0 +1 @@ +/usr/lib/qubes/prepare-suspend resume diff --git a/qubes_rpc/qubes.SuspendPre b/qubes_rpc/qubes.SuspendPre new file mode 100644 index 0000000..ad49fa6 --- /dev/null +++ b/qubes_rpc/qubes.SuspendPre @@ -0,0 +1 @@ +/usr/lib/qubes/prepare-suspend suspend diff --git a/rpm_spec/core-vm.spec b/rpm_spec/core-vm.spec index 829a6ec..f24c679 100644 --- a/rpm_spec/core-vm.spec +++ b/rpm_spec/core-vm.spec @@ -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