* [PATCH] rootfs-postcommands.bbclass: Change the default.target location
@ 2022-01-10 15:37 Peter Kjellerstedt
2022-01-10 15:44 ` [OE-core] " Richard Purdie
0 siblings, 1 reply; 5+ messages in thread
From: Peter Kjellerstedt @ 2022-01-10 15:37 UTC (permalink / raw)
To: openembedded-core
Rather than adding a default.target in /etc/systemd/system, modify the
one in /usr/lib/systemd/system.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
meta/classes/rootfs-postcommands.bbclass | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index a3f96ef7ed..713ae5bfe0 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -218,8 +218,9 @@ postinst_enable_logging () {
# Modify systemd default target
#
set_systemd_default_target () {
- if [ -d ${IMAGE_ROOTFS}${sysconfdir}/systemd/system -a -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ]; then
- ln -sf ${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ${IMAGE_ROOTFS}${sysconfdir}/systemd/system/default.target
+ if [ "${SYSTEMD_DEFAULT_TARGET}" ] &&
+ [ -e ${IMAGE_ROOTFS}${systemd_system_unitdir}/${SYSTEMD_DEFAULT_TARGET} ]; then
+ ln -sf ${SYSTEMD_DEFAULT_TARGET} ${IMAGE_ROOTFS}${systemd_system_unitdir}/default.target
fi
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] rootfs-postcommands.bbclass: Change the default.target location
2022-01-10 15:37 [PATCH] rootfs-postcommands.bbclass: Change the default.target location Peter Kjellerstedt
@ 2022-01-10 15:44 ` Richard Purdie
2022-01-10 20:33 ` Peter Kjellerstedt
0 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2022-01-10 15:44 UTC (permalink / raw)
To: Peter Kjellerstedt, openembedded-core
On Mon, 2022-01-10 at 16:37 +0100, Peter Kjellerstedt wrote:
> Rather than adding a default.target in /etc/systemd/system, modify the
> one in /usr/lib/systemd/system.
Why?
(the commit message needs to say why as well as what it does)
Cheers,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [OE-core] [PATCH] rootfs-postcommands.bbclass: Change the default.target location
2022-01-10 15:44 ` [OE-core] " Richard Purdie
@ 2022-01-10 20:33 ` Peter Kjellerstedt
2022-01-10 20:39 ` Konrad Weihmann
2022-01-10 20:39 ` Alexander Kanavin
0 siblings, 2 replies; 5+ messages in thread
From: Peter Kjellerstedt @ 2022-01-10 20:33 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
> -----Original Message-----
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> Sent: den 10 januari 2022 16:44
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH] rootfs-postcommands.bbclass: Change the
> default.target location
>
> On Mon, 2022-01-10 at 16:37 +0100, Peter Kjellerstedt wrote:
> > Rather than adding a default.target in /etc/systemd/system, modify the
> > one in /usr/lib/systemd/system.
>
> Why?
>
> (the commit message needs to say why as well as what it does)
I thought it did (avoid having two links where one will suffice).
>
> Cheers,
>
> Richard
Thinking a bit more about this though, I am not sure I can win. We have
had a corresponding local patch for many years, and it seems natural to
have the link only in /usr/lib/systemd/system. However, for a system that
uses package management (which we do not), it may not be as natural,
since then updating the systemd package in runtime would restore systemd's
default.target rather than the one that was installed with the system.
Would you accept a patch that instead introduces a variable for the path
to the default.target link, with the following definition:
SYSTEMD_DEFAULT_TARGET_PATH ?= "${@bb.utils.contains('IMAGE_FEATURES', 'package-management', '${sysconfdir}/systemd/system', '${systemd_system_unitdir}', d}"
That would make it reasonably sane by default, but still allow it to be
overridden if you have other ideas for your system.
//Peter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] rootfs-postcommands.bbclass: Change the default.target location
2022-01-10 20:33 ` Peter Kjellerstedt
@ 2022-01-10 20:39 ` Konrad Weihmann
2022-01-10 20:39 ` Alexander Kanavin
1 sibling, 0 replies; 5+ messages in thread
From: Konrad Weihmann @ 2022-01-10 20:39 UTC (permalink / raw)
To: Peter Kjellerstedt, Richard Purdie, openembedded-core
On 10.01.22 21:33, Peter Kjellerstedt wrote:
>> -----Original Message-----
>> From: Richard Purdie <richard.purdie@linuxfoundation.org>
>> Sent: den 10 januari 2022 16:44
>> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
>> core@lists.openembedded.org
>> Subject: Re: [OE-core] [PATCH] rootfs-postcommands.bbclass: Change the
>> default.target location
>>
>> On Mon, 2022-01-10 at 16:37 +0100, Peter Kjellerstedt wrote:
>>> Rather than adding a default.target in /etc/systemd/system, modify the
>>> one in /usr/lib/systemd/system.
>>
>> Why?
>>
>> (the commit message needs to say why as well as what it does)
>
> I thought it did (avoid having two links where one will suffice).
>
>>
>> Cheers,
>>
>> Richard
>
> Thinking a bit more about this though, I am not sure I can win. We have
> had a corresponding local patch for many years, and it seems natural to
> have the link only in /usr/lib/systemd/system. However, for a system that
> uses package management (which we do not), it may not be as natural,
> since then updating the systemd package in runtime would restore systemd's
> default.target rather than the one that was installed with the system.
>
> Would you accept a patch that instead introduces a variable for the path
> to the default.target link, with the following definition:
>
> SYSTEMD_DEFAULT_TARGET_PATH ?= "${@bb.utils.contains('IMAGE_FEATURES', 'package-management', '${sysconfdir}/systemd/system', '${systemd_system_unitdir}', d}"
IMO that would look overly complicated.
Just pointing out that, with your patch, people can alter the default
target by placing an appropriate link in /etc/systemd/... to override
the default choices would be enough.
I guess changing things in /lib/systemd for an image makes more sense,
it only has to be named in the commit message
Honestly I don't think it needs another variable to achieve the goal you
had in mind
Konrad
>
> That would make it reasonably sane by default, but still allow it to be
> overridden if you have other ideas for your system.
>
> //Peter
>
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#160377): https://lists.openembedded.org/g/openembedded-core/message/160377
> Mute This Topic: https://lists.openembedded.org/mt/88325758/3647476
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [kweihmann@outlook.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] rootfs-postcommands.bbclass: Change the default.target location
2022-01-10 20:33 ` Peter Kjellerstedt
2022-01-10 20:39 ` Konrad Weihmann
@ 2022-01-10 20:39 ` Alexander Kanavin
1 sibling, 0 replies; 5+ messages in thread
From: Alexander Kanavin @ 2022-01-10 20:39 UTC (permalink / raw)
To: Peter Kjellerstedt; +Cc: Richard Purdie, openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]
On Mon, 10 Jan 2022 at 21:33, Peter Kjellerstedt <
peter.kjellerstedt@axis.com> wrote:
> Thinking a bit more about this though, I am not sure I can win. We have
> had a corresponding local patch for many years, and it seems natural to
> have the link only in /usr/lib/systemd/system. However, for a system that
> uses package management (which we do not), it may not be as natural,
> since then updating the systemd package in runtime would restore systemd's
> default.target rather than the one that was installed with the system.
>
> Would you accept a patch that instead introduces a variable for the path
> to the default.target link, with the following definition:
>
> SYSTEMD_DEFAULT_TARGET_PATH ?= "${@bb.utils.contains('IMAGE_FEATURES',
> 'package-management', '${sysconfdir}/systemd/system',
> '${systemd_system_unitdir}', d}"
>
> That would make it reasonably sane by default, but still allow it to be
> overridden if you have other ideas for your system.
>
I think you can mark certain files as 'configuration' and then package
management won't touch them during updates?
Alex
[-- Attachment #2: Type: text/html, Size: 1609 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-10 20:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 15:37 [PATCH] rootfs-postcommands.bbclass: Change the default.target location Peter Kjellerstedt
2022-01-10 15:44 ` [OE-core] " Richard Purdie
2022-01-10 20:33 ` Peter Kjellerstedt
2022-01-10 20:39 ` Konrad Weihmann
2022-01-10 20:39 ` Alexander Kanavin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.