* [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
* Re: [PATCH] rfkill: Add systemd integration
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
1 sibling, 0 replies; 9+ messages in thread
From: Sami Kerola @ 2018-11-22 10:03 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux
On Thu, 22 Nov 2018 at 03:12, Stanislav Brabec <sbrabec@suse.cz> wrote:
> Example:
> Use `systemctl {start,stop} rfkill-block@bluetooth` to block or unblock
> (disable or enable) the bluetooth device.
Would it make sense to add that to manual page examples section, something like:
diff --git a/sys-utils/rfkill.8 b/sys-utils/rfkill.8
index 9eff913b8..99b1748dd 100644
--- a/sys-utils/rfkill.8
+++ b/sys-utils/rfkill.8
@@ -82,6 +82,10 @@ rfkill block all
rfkill unblock wlan
.br
rfkill block bluetooth uwb wimax wwan gps fm nfc
+.PP
+systemctl {start,stop} rfkill-block@bluetooth
+.br
+To make systemd to block or unblock the bluetooth device.
.SH AUTHORS
.B rfkill
was originally written by
And even if not:
Acked-by: Sami Kerola <kerolasa@iki.fi>
--
Sami Kerola
http://www.iki.fi/kerolasa/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] rfkill: Add systemd integration
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
1 sibling, 1 reply; 9+ messages in thread
From: Karel Zak @ 2018-11-22 10:39 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux
On Wed, Nov 21, 2018 at 09:04:37PM +0100, Stanislav Brabec wrote:
> 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.
OK, but why? ;-)
Does anything within systemd depend on rfkill? I guess for humans is
more friendly to call "rfkill unblock bluetooth" than use systemctl.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rfkill: Add systemd integration
2018-11-22 10:39 ` Karel Zak
@ 2018-11-22 16:09 ` Stanislav Brabec
2018-11-24 8:15 ` Sami Kerola
0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Brabec @ 2018-11-22 16:09 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
Karel Zak wrote:
> On Wed, Nov 21, 2018 at 09:04:37PM +0100, Stanislav Brabec wrote:
>> 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.
>
> OK, but why? ;-)
>
> Does anything within systemd depend on rfkill? I guess for humans is
> more friendly to call "rfkill unblock bluetooth" than use systemctl.
I am not sure about use case of the original author, but I guess
that it can be useful for suspend target and automatic unblocking when
using on demand services (e. g. bluetooth service called after
rfkill-unblock@bluetooth).
--
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 [flat|nested] 9+ messages in thread
* Re: [PATCH] rfkill: Add systemd integration
2018-11-22 16:09 ` Stanislav Brabec
@ 2018-11-24 8:15 ` Sami Kerola
2018-11-27 18:16 ` Stanislav Brabec
0 siblings, 1 reply; 9+ messages in thread
From: Sami Kerola @ 2018-11-24 8:15 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: Karel Zak, util-linux
On Sat, 24 Nov 2018 at 02:25, Stanislav Brabec <sbrabec@suse.cz> wrote:
> Karel Zak wrote:
> > On Wed, Nov 21, 2018 at 09:04:37PM +0100, Stanislav Brabec wrote:
> >> 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.
> >
> > OK, but why? ;-)
> >
> > Does anything within systemd depend on rfkill? I guess for humans is
> > more friendly to call "rfkill unblock bluetooth" than use systemctl.
>
> I am not sure about use case of the original author, but I guess
> that it can be useful for suspend target and automatic unblocking when
> using on demand services (e. g. bluetooth service called after
> rfkill-unblock@bluetooth).
systemd has service[1] to maintain RF kill switch state as requested across
reboots. I think these rfkill-{block,unblock}@{target} files are
convenience services to change RF kill states with systemctl. That said,
getting a clarification from Jochen would nice because otherwise we are
simply guessing.
[1] https://www.freedesktop.org/software/systemd/man/systemd-rfkill.service.html
--
Sami Kerola
http://www.iki.fi/kerolasa/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] rfkill: Add systemd integration
2018-11-24 8:15 ` Sami Kerola
@ 2018-11-27 18:16 ` Stanislav Brabec
2018-12-10 12:53 ` Karel Zak
0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Brabec @ 2018-11-27 18:16 UTC (permalink / raw)
To: kerolasa; +Cc: Karel Zak, util-linux
Sami Kerola wrote:
That said,
> getting a clarification from Jochen would nice because otherwise we are
> simply guessing.
Jochen Keil already left SUSE and I have no contact e-mail to him.
But I got complain that it is missing after migration of rfkill to util-linux:
https://bugzilla.opensuse.org/show_bug.cgi?id=1092820
--
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 [flat|nested] 9+ messages in thread
* Re: [PATCH] rfkill: Add systemd integration
2018-11-27 18:16 ` Stanislav Brabec
@ 2018-12-10 12:53 ` Karel Zak
2018-12-10 13:12 ` [systemd-devel] " Lennart Poettering
0 siblings, 1 reply; 9+ messages in thread
From: Karel Zak @ 2018-12-10 12:53 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux, systemd-devel
On Tue, Nov 27, 2018 at 07:16:04PM +0100, Stanislav Brabec wrote:
> Sami Kerola wrote:
> That said,
> > getting a clarification from Jochen would nice because otherwise we are
> > simply guessing.
>
> Jochen Keil already left SUSE and I have no contact e-mail to him.
>
> But I got complain that it is missing after migration of rfkill to util-linux:
> https://bugzilla.opensuse.org/show_bug.cgi?id=1092820
It seems the best would be to ask upstream systemd guys. Maybe it's
really Suse specific and maybe it's something we can support for more
distros. I don't know.
All thread:
https://lore.kernel.org/util-linux/0ce3309a-009a-7c00-3a2c-e4917b894f8c@suse.cz/T/#m221ad50b88792236c10c507f9163b57761c254a7
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [systemd-devel] [PATCH] rfkill: Add systemd integration
2018-12-10 12:53 ` Karel Zak
@ 2018-12-10 13:12 ` Lennart Poettering
2018-12-10 18:12 ` Stanislav Brabec
0 siblings, 1 reply; 9+ messages in thread
From: Lennart Poettering @ 2018-12-10 13:12 UTC (permalink / raw)
To: Karel Zak; +Cc: Stanislav Brabec, util-linux, systemd-devel
On Mo, 10.12.18 13:53, Karel Zak (kzak@redhat.com) wrote:
65;5402;1c
> On Tue, Nov 27, 2018 at 07:16:04PM +0100, Stanislav Brabec wrote:
> > Sami Kerola wrote:
> > That said,
> > > getting a clarification from Jochen would nice because otherwise we are
> > > simply guessing.
> >
> > Jochen Keil already left SUSE and I have no contact e-mail to him.
> >
> > But I got complain that it is missing after migration of rfkill to util-linux:
> > https://bugzilla.opensuse.org/show_bug.cgi?id=1092820
>
> It seems the best would be to ask upstream systemd guys. Maybe it's
> really Suse specific and maybe it's something we can support for more
> distros. I don't know.
>
> All thread:
> https://lore.kernel.org/util-linux/0ce3309a-009a-7c00-3a2c-e4917b894f8c@suse.cz/T/#m221ad50b88792236c10c507f9163b57761c254a7
Hmm, what's the usecase for this?
I mean, "systemctl start rfkill-block@xyz.service" isn't that much
nicer to type than "rfkill block xyz", no? In fact, quite the opposite
I'd say...
Or this is about enable/disabling rfkill at subsequent boot, using
"systemctl enable rfkill-block@xyz.service"? This kinda conflicts with
the save/restore logic systemd-rfkill@.service (as shipped with
systemd) implements already. It might make sense to extend that tool
slightly, for example by defining a udev property or so to check which
can override the saved data statically. Or definining a kernel cmdline
option to override the rfkill save/restore logic globally. But I am
pretty sure that one should be careful with having two different
packages run at boot to set the initial rfkill setting, because they
will fight about it.
Lennart
--
Lennart Poettering, Red Hat
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [systemd-devel] [PATCH] rfkill: Add systemd integration
2018-12-10 13:12 ` [systemd-devel] " Lennart Poettering
@ 2018-12-10 18:12 ` Stanislav Brabec
0 siblings, 0 replies; 9+ messages in thread
From: Stanislav Brabec @ 2018-12-10 18:12 UTC (permalink / raw)
To: Lennart Poettering, Karel Zak; +Cc: util-linux, systemd-devel
On Mon, Dec 10, 2018 at 2:12PM Lennart Poettering wrote:
> Or this is about enable/disabling rfkill at subsequent boot, using
> "systemctl enable rfkill-block@xyz.service"? This kinda conflicts with
> the save/restore logic systemd-rfkill@.service
Thanks for explanation, I will drop rfkill-block@.service and
rfkill-unblock@.service from future SUSE releases.
--
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 [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).