* [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
@ 2013-07-24 7:18 Michał Górny
2013-07-24 8:28 ` Tom Wijsman
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Michał Górny @ 2013-07-24 7:18 UTC (permalink / raw
To: gentoo-dev; +Cc: systemd, Michał Górny
Pacho requested that to be able to warn users in GNOME packages that do
not work anymore without systemd.
---
gx86/eclass/systemd.eclass | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/gx86/eclass/systemd.eclass b/gx86/eclass/systemd.eclass
index 166c7be..a2750d7 100644
--- a/gx86/eclass/systemd.eclass
+++ b/gx86/eclass/systemd.eclass
@@ -252,3 +252,20 @@ systemd_update_catalog() {
debug-print "${FUNCNAME}: journalctl not found."
fi
}
+
+# @FUNCTION: systemd_is_booted
+# @DESCRIPTION:
+# Check whether the system was booted using systemd.
+#
+# Returns 0 if systemd is used to boot the system, 1 otherwise.
+#
+# See: man sd_booted
+systemd_update_catalog() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ -d /run/systemd/system ]]
+ local ret=${?}
+
+ debug-print "${FUNCNAME}: [[ -d /run/systemd/system ]] -> ${ret}"
+ return ${ret}
+}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 7:18 [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted() Michał Górny
@ 2013-07-24 8:28 ` Tom Wijsman
2013-07-24 8:36 ` Sergei Trofimovich
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Tom Wijsman @ 2013-07-24 8:28 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]
On Wed, 24 Jul 2013 09:18:13 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> Pacho requested that to be able to warn users in GNOME packages that
> do not work anymore without systemd.
>
> +# @FUNCTION: systemd_is_booted
> +# @DESCRIPTION:
> +# Check whether the system was booted using systemd.
Can we have a short mention of that kind of usage in the description?
There is some set of possible wrong usages, some of which are nasty,
that this function should not be used for; for example, someone could
use this as a check to install a file which I believe isn't permitted.
Are there even other legit usages your original function would permit?
Alternatively, you could change the function altogether into something
more specific; eg. ewarn_systemd_boot and ewarn_no_systemd_boot.
These functions would then take a message as parameter; then the
resulting behavior of this function is in your hands, not the consumer.
--
With kind regards,
Tom Wijsman (TomWij)
Gentoo Developer
E-mail address : TomWij@gentoo.org
GPG Public Key : 6D34E57D
GPG Fingerprint : C165 AF18 AB4C 400B C3D2 ABF0 95B2 1FCD 6D34 E57D
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 7:18 [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted() Michał Górny
2013-07-24 8:28 ` Tom Wijsman
@ 2013-07-24 8:36 ` Sergei Trofimovich
2013-07-24 8:41 ` Michał Górny
2013-07-24 14:17 ` Ulrich Mueller
2013-07-27 10:37 ` Michał Górny
3 siblings, 1 reply; 12+ messages in thread
From: Sergei Trofimovich @ 2013-07-24 8:36 UTC (permalink / raw
To: gentoo-dev; +Cc: mgorny, systemd
[-- Attachment #1: Type: text/plain, Size: 192 bytes --]
On Wed, 24 Jul 2013 09:18:13 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> +# @FUNCTION: systemd_is_booted
> +systemd_update_catalog() {
Looks like a typo :]
--
Sergei
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 8:36 ` Sergei Trofimovich
@ 2013-07-24 8:41 ` Michał Górny
0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2013-07-24 8:41 UTC (permalink / raw
To: gentoo-dev; +Cc: slyfox, systemd
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
Dnia 2013-07-24, o godz. 11:36:12
Sergei Trofimovich <slyfox@gentoo.org> napisał(a):
> On Wed, 24 Jul 2013 09:18:13 +0200
> Michał Górny <mgorny@gentoo.org> wrote:
>
>
> > +# @FUNCTION: systemd_is_booted
> > +systemd_update_catalog() {
>
> Looks like a typo :]
Thanks for noticing. Does anyone else feel that eclassdoc is utterly
irritating and encourages that kind of mistakes?
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 7:18 [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted() Michał Górny
2013-07-24 8:28 ` Tom Wijsman
2013-07-24 8:36 ` Sergei Trofimovich
@ 2013-07-24 14:17 ` Ulrich Mueller
2013-07-24 14:19 ` Ian Stakenvicius
` (2 more replies)
2013-07-27 10:37 ` Michał Górny
3 siblings, 3 replies; 12+ messages in thread
From: Ulrich Mueller @ 2013-07-24 14:17 UTC (permalink / raw
To: gentoo-dev; +Cc: systemd, Michał Górny
>>>>> On Wed, 24 Jul 2013, Michał Górny wrote:
> Pacho requested that to be able to warn users in GNOME packages that
> do not work anymore without systemd.
Why is the host where the package is built required to run systemd?
Wouldn't a warning at runtime better suit the purpose?
Ulrich
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 14:17 ` Ulrich Mueller
@ 2013-07-24 14:19 ` Ian Stakenvicius
2013-07-24 14:33 ` Alexandre Rostovtsev
2013-07-24 17:38 ` Michał Górny
2 siblings, 0 replies; 12+ messages in thread
From: Ian Stakenvicius @ 2013-07-24 14:19 UTC (permalink / raw
To: gentoo-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 24/07/13 10:17 AM, Ulrich Mueller wrote:
>>>>>> On Wed, 24 Jul 2013, Michał Górny wrote:
>
>> Pacho requested that to be able to warn users in GNOME packages
>> that do not work anymore without systemd.
>
> Why is the host where the package is built required to run
> systemd? Wouldn't a warning at runtime better suit the purpose?
>
> Ulrich
>
Agreed -- although this function could still have uses, ie, in
pkg_postinst to do certain things if systemd is running, no?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
iF4EAREIAAYFAlHv4osACgkQ2ugaI38ACPCNeAEAlqSpCrIcH5gdXFwNI4mna9yw
VziYKhZrDB+4+8h40SoA/RXkCjLOhnVmVBSZP5zKmu3qih2H7mJcob/7dGkIp5Cw
=4Wtp
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 14:17 ` Ulrich Mueller
2013-07-24 14:19 ` Ian Stakenvicius
@ 2013-07-24 14:33 ` Alexandre Rostovtsev
2013-07-24 14:43 ` Alex Xu
2013-07-24 15:34 ` Ian Stakenvicius
2013-07-24 17:38 ` Michał Górny
2 siblings, 2 replies; 12+ messages in thread
From: Alexandre Rostovtsev @ 2013-07-24 14:33 UTC (permalink / raw
To: gentoo-dev; +Cc: systemd
On Wed, 2013-07-24 at 16:17 +0200, Ulrich Mueller wrote:
> >>>>> On Wed, 24 Jul 2013, Michał Górny wrote:
>
> > Pacho requested that to be able to warn users in GNOME packages that
> > do not work anymore without systemd.
>
> Why is the host where the package is built required to run systemd?
> Wouldn't a warning at runtime better suit the purpose?
The purpose of systemd_is_booted() is to provide helpful postinst
messages to users depending on whether or not they are running systemd,
and for the vast majority of users, the machine where the package is
built is the machine where the package will be run.
Runtime warnings would require non-trivial patching of the packages in
question, so it's not a realistic alternative.
Those who have separate build hosts are probably sufficiently
technically proficient to understand if the message does not apply to
their case.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 14:33 ` Alexandre Rostovtsev
@ 2013-07-24 14:43 ` Alex Xu
2013-07-24 15:34 ` Ian Stakenvicius
1 sibling, 0 replies; 12+ messages in thread
From: Alex Xu @ 2013-07-24 14:43 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]
On 24/07/13 10:33 AM, Alexandre Rostovtsev wrote:
> On Wed, 2013-07-24 at 16:17 +0200, Ulrich Mueller wrote:
>>>>>>> On Wed, 24 Jul 2013, Michał Górny wrote:
>>
>>> Pacho requested that to be able to warn users in GNOME packages that
>>> do not work anymore without systemd.
>>
>> Why is the host where the package is built required to run systemd?
>> Wouldn't a warning at runtime better suit the purpose?
>
> The purpose of systemd_is_booted() is to provide helpful postinst
> messages to users depending on whether or not they are running systemd,
> and for the vast majority of users, the machine where the package is
> built is the machine where the package will be run.
>
> Runtime warnings would require non-trivial patching of the packages in
> question, so it's not a realistic alternative.
>
> Those who have separate build hosts are probably sufficiently
> technically proficient to understand if the message does not apply to
> their case.
>
>
So it is sufficient to add e.g. ewarn_systemd_is_not_booted() (possibly
with a better name) to discourage inappropriate use cases?
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 14:33 ` Alexandre Rostovtsev
2013-07-24 14:43 ` Alex Xu
@ 2013-07-24 15:34 ` Ian Stakenvicius
2013-07-24 18:49 ` Pacho Ramos
1 sibling, 1 reply; 12+ messages in thread
From: Ian Stakenvicius @ 2013-07-24 15:34 UTC (permalink / raw
To: gentoo-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 24/07/13 10:33 AM, Alexandre Rostovtsev wrote:
>
> Runtime warnings would require non-trivial patching of the
> packages in question, so it's not a realistic alternative.
>
It should be done anyways, though, unless the runtime errors
themselves are obvious enough to understand.
A News item would be good, too. In fact, perhaps this pkg_postinst()
warning should exist no matter what the end-user is running, just so
they know they can't trivially switch back to sysvinit/openrc??
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)
iF4EAREIAAYFAlHv8/YACgkQ2ugaI38ACPAFzAD/XfUg1IjWB4dBCCq32rFuy74A
+W42E6fXnBdgfTDFA38A/RZfHDjdPDTydt8FBc0IS/+h/22qlbbuPEJypv04VgAa
=Imh1
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 14:17 ` Ulrich Mueller
2013-07-24 14:19 ` Ian Stakenvicius
2013-07-24 14:33 ` Alexandre Rostovtsev
@ 2013-07-24 17:38 ` Michał Górny
2 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2013-07-24 17:38 UTC (permalink / raw
To: gentoo-dev; +Cc: ulm, systemd
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]
Dnia 2013-07-24, o godz. 16:17:47
Ulrich Mueller <ulm@gentoo.org> napisał(a):
> >>>>> On Wed, 24 Jul 2013, Michał Górny wrote:
>
> > Pacho requested that to be able to warn users in GNOME packages that
> > do not work anymore without systemd.
>
> Why is the host where the package is built required to run systemd?
> Wouldn't a warning at runtime better suit the purpose?
Warning at pkg_postinst() for non-pure-package build seems best.
A warning at meantime seems not meaningful. It would just be a small
warning compared to the big runtime problem that package does not work
anymore.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 15:34 ` Ian Stakenvicius
@ 2013-07-24 18:49 ` Pacho Ramos
0 siblings, 0 replies; 12+ messages in thread
From: Pacho Ramos @ 2013-07-24 18:49 UTC (permalink / raw
To: gentoo-dev
El mié, 24-07-2013 a las 11:34 -0400, Ian Stakenvicius escribió:
> On 24/07/13 10:33 AM, Alexandre Rostovtsev wrote:
> >
> > Runtime warnings would require non-trivial patching of the
> > packages in question, so it's not a realistic alternative.
> >
>
> It should be done anyways, though, unless the runtime errors
> themselves are obvious enough to understand.
>
> A News item would be good, too. In fact, perhaps this pkg_postinst()
> warning should exist no matter what the end-user is running, just so
> they know they can't trivially switch back to sysvinit/openrc??
>
A news item will be added for sure before Gnome 3.8 gets stabilized,
this was more to be even more sure people know that information
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().
2013-07-24 7:18 [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted() Michał Górny
` (2 preceding siblings ...)
2013-07-24 14:17 ` Ulrich Mueller
@ 2013-07-27 10:37 ` Michał Górny
3 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2013-07-27 10:37 UTC (permalink / raw
To: gentoo-dev; +Cc: systemd
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
Dnia 2013-07-24, o godz. 09:18:13
Michał Górny <mgorny@gentoo.org> napisał(a):
> Pacho requested that to be able to warn users in GNOME packages that do
> not work anymore without systemd.
Committed with a little more verbose description, and a MERGE_TYPE note.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-07-27 10:37 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-24 7:18 [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted() Michał Górny
2013-07-24 8:28 ` Tom Wijsman
2013-07-24 8:36 ` Sergei Trofimovich
2013-07-24 8:41 ` Michał Górny
2013-07-24 14:17 ` Ulrich Mueller
2013-07-24 14:19 ` Ian Stakenvicius
2013-07-24 14:33 ` Alexandre Rostovtsev
2013-07-24 14:43 ` Alex Xu
2013-07-24 15:34 ` Ian Stakenvicius
2013-07-24 18:49 ` Pacho Ramos
2013-07-24 17:38 ` Michał Górny
2013-07-27 10:37 ` Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox