util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rfkill: Add systemd integration
@ 2018-11-21 20:04 Stanislav Brabec
  2018-11-22 10:03 ` Sami Kerola
  2018-11-22 10:39 ` Karel Zak
  0 siblings, 2 replies; 9+ messages in thread
From: Stanislav Brabec @ 2018-11-21 20:04 UTC (permalink / raw)
  To: util-linux

Add rfkill-block@.service and rfkill-unblock@.service templates.
These make rfkill integration to systemd easier.

Files come from openSUSE rfkill package.

Example:
Use `systemctl {start,stop} rfkill-block@bluetooth` to block or unblock
(disable or enable) the bluetooth device.

Author: Jochen Keil <jkeil@suse.de>
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
 sys-utils/Makemodule.am              | 10 +++++++++-
 sys-utils/rfkill-block@.service.in   | 11 +++++++++++
 sys-utils/rfkill-unblock@.service.in | 11 +++++++++++
 3 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 sys-utils/rfkill-block@.service.in
 create mode 100644 sys-utils/rfkill-unblock@.service.in

diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
index 825a7335b..0baa6e421 100644
--- a/sys-utils/Makemodule.am
+++ b/sys-utils/Makemodule.am
@@ -72,6 +72,11 @@ dist_man_MANS += sys-utils/rfkill.8
 rfkill_SOURCES = sys-utils/rfkill.c
 rfkill_LDADD = $(LDADD) libcommon.la libsmartcols.la
 rfkill_CFLAGS = $(AM_CFLAGS) -I$(ul_libsmartcols_incdir)
+if HAVE_SYSTEMD
+systemdsystemunit_DATA += \
+		sys-utils/rfkill-block@.service \
+		sys-utils/rfkill-unblock@.service
+endif
 endif
 
 if BUILD_SETSID
@@ -106,7 +111,10 @@ systemdsystemunit_DATA += \
 endif
 endif # BUILD_FSTRIM
 
-PATHFILES += sys-utils/fstrim.service
+PATHFILES += \
+	sys-utils/fstrim.service \
+	sys-utils/rfkill-block@.service \
+	sys-utils/rfkill-unblock@.service
 EXTRA_DIST += sys-utils/fstrim.timer
 
 if BUILD_DMESG
diff --git a/sys-utils/rfkill-block@.service.in b/sys-utils/rfkill-block@.service.in
new file mode 100644
index 000000000..c1ee0b467
--- /dev/null
+++ b/sys-utils/rfkill-block@.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Disable Device %I by RFKill
+After=rfkill-unblock@all.service
+Documentation=man:rfkill(8)
+
+[Service]
+Type=oneshot
+ExecStart=@usrsbin_execdir@/rfkill block %I
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-utils/rfkill-unblock@.service.in b/sys-utils/rfkill-unblock@.service.in
new file mode 100644
index 000000000..bd9c4befe
--- /dev/null
+++ b/sys-utils/rfkill-unblock@.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Enable Device %I by RFKill
+After=rfkill-block@all.service
+Documentation=man:rfkill(8)
+
+[Service]
+Type=oneshot
+ExecStart=@usrsbin_execdir@/rfkill unblock %I
+
+[Install]
+WantedBy=multi-user.target
-- 
2.19.1

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.com
Křižíkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-12-10 18:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 20:04 [PATCH] rfkill: Add systemd integration Stanislav Brabec
2018-11-22 10:03 ` Sami Kerola
2018-11-22 10:39 ` Karel Zak
2018-11-22 16:09   ` Stanislav Brabec
2018-11-24  8:15     ` Sami Kerola
2018-11-27 18:16       ` Stanislav Brabec
2018-12-10 12:53         ` Karel Zak
2018-12-10 13:12           ` [systemd-devel] " Lennart Poettering
2018-12-10 18:12             ` Stanislav Brabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).