Browse Source

Remove hard systemd dependency from the sleep script

By using nmcli, users who don't use a systemd based distribution (Gentoo etc.),
can run the sleep script manually, or hook it up to their service manager manually.

This also removes the forced restart if people willingly disabled NetworkManager.

Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
Dorian Stoll 5 years ago
parent
commit
aee8e310e0
1 changed files with 5 additions and 1 deletions
  1. 5 1
      root/lib/systemd/system-sleep/sleep

+ 5 - 1
root/lib/systemd/system-sleep/sleep

@@ -39,7 +39,11 @@ case $1 in
     modprobe mwifiex;
     modprobe mwifiex;
     modprobe mwifiex_pcie;
     modprobe mwifiex_pcie;
     echo 1 > /sys/bus/pci/rescan
     echo 1 > /sys/bus/pci/rescan
-    systemctl restart NetworkManager.service
+
+    if [ -x "$(command -v nmcli)" ]  && [ "$(nmcli net)" = "enabled" ]; then
+      nmcli net off
+      nmcli net on
+    fi
     ;;
     ;;
 esac
 esac