util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Brabec <sbrabec@suse.cz>
To: util-linux@vger.kernel.org
Subject: [PATCH] rfkill: Add systemd integration
Date: Wed, 21 Nov 2018 21:04:37 +0100	[thread overview]
Message-ID: <0ad9b6ea-0d46-5ec5-1bfc-0e48be52dae8@suse.cz> (raw)

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

             reply	other threads:[~2018-11-21 20:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 20:04 Stanislav Brabec [this message]
2018-11-22 10:03 ` [PATCH] rfkill: Add systemd integration 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0ad9b6ea-0d46-5ec5-1bfc-0e48be52dae8@suse.cz \
    --to=sbrabec@suse.cz \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).