[arch-projects] [netcfg] [PATCH] systemd: suspend profiles upon sleep (as in pm-utils)

Ivan Shapovalov intelfx100 at gmail.com
Thu Oct 25 14:45:29 EDT 2012


Add a unit file and statically install it to sleep.target.wants
since "netcfg all-suspend" / "netcfg all-resume" are no-ops when no
netcfg profiles are activated so they are safe to invoke every time.
---
 Makefile                       |  3 +++
 systemd/netcfg-suspend.service | 10 ++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 systemd/netcfg-suspend.service

diff --git a/Makefile b/Makefile
index bbada3f..1396820 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,9 @@ install: install-docs
 	install -m644 \
 	    systemd/*.service \
 	    $(DESTDIR)/usr/lib/systemd/system/
+	install -d $(DESTDIR)/usr/lib/systemd/system/sleep.target.wants
+	ln -s ../netcfg-suspend.service \
+		$(DESTDIR)/usr/lib/systemd/sleep.target.wants
 
 install-docs: docs
 	install -d $(DESTDIR)/usr/share/man/{man5,man8}
diff --git a/systemd/netcfg-suspend.service b/systemd/netcfg-suspend.service
new file mode 100644
index 0000000..c4ad1a9
--- /dev/null
+++ b/systemd/netcfg-suspend.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Suspend netcfg profiles upon sleep
+PartOf=sleep.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/netcfg all-suspend
+ExecStop=/usr/bin/netcfg all-resume
+KillMode=none
-- 
1.8.0




More information about the arch-projects mailing list