prepare-suspend 690 B

12345678910111213141516171819
  1. #!/bin/sh
  2. action=$1
  3. [ -z "$action" ] && action=suspend
  4. if [ x"$action" == x"suspend" ]; then
  5. nmcli nm sleep true || service NetworkManager stop
  6. # Force interfaces down, just in case when NM didn't done it
  7. for if in `ls /sys/class/net|grep -v "lo\|vif"`; do
  8. ip l s $if down
  9. done
  10. modprobe -r uhci_hcd ehci_hcd ehci_pci
  11. lsmod|grep -q iwldvm && touch /var/run/qubes/suspend-iwldvm-loaded
  12. modprobe -r iwldvm
  13. else
  14. modprobe ehci_pci; modprobe uhci_hcd
  15. test -e /var/run/qubes/suspend-iwldvm-loaded && modprobe iwldvm
  16. nmcli nm sleep false || { [ -x /bin/systemctl ] && systemctl start NetworkManager.service; } || service qubes-core-netvm start
  17. fi