From aee8e310e0e1ff34762ef1f0ffe606b912df152d Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Tue, 1 Oct 2019 12:13:59 +0200 Subject: [PATCH] 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 --- root/lib/systemd/system-sleep/sleep | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/root/lib/systemd/system-sleep/sleep b/root/lib/systemd/system-sleep/sleep index 0076f0810..f621d35a0 100644 --- a/root/lib/systemd/system-sleep/sleep +++ b/root/lib/systemd/system-sleep/sleep @@ -39,7 +39,11 @@ case $1 in modprobe mwifiex; modprobe mwifiex_pcie; 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