* [ptxdist] [PATCH] machine-id: make using rc-once optional
@ 2020-11-30 10:42 Artur Wiebe
2020-12-04 6:32 ` Michael Olbrich
0 siblings, 1 reply; 7+ messages in thread
From: Artur Wiebe @ 2020-11-30 10:42 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
If not set only an empty /etc/machine-id will be installed.
Signed-off-by: Artur Wiebe <artur@4wiebe.de>
---
projectroot/etc/machine-id | 0
rules/machine-id.in | 22 ++++++++++++++++++----
rules/machine-id.make | 4 ++++
rules/machine-id.postinst | 5 +++--
4 files changed, 25 insertions(+), 6 deletions(-)
create mode 100644 projectroot/etc/machine-id
diff --git a/projectroot/etc/machine-id b/projectroot/etc/machine-id
new file mode 100644
index 000000000..e69de29bb
diff --git a/rules/machine-id.in b/rules/machine-id.in
index f18fec554..2a3901f41 100644
--- a/rules/machine-id.in
+++ b/rules/machine-id.in
@@ -1,11 +1,25 @@
## SECTION=initmethod
-config MACHINE_ID
+menuconfig MACHINE_ID
tristate
prompt "create /etc/machine-id"
- select RC_ONCE if RUNTIME
- select UTIL_LINUX_NG if !INITMETHOD_SYSTEMD
- select UTIL_LINUX_NG_UUIDGEN if !INITMETHOD_SYSTEMD
+ select RC_ONCE if MACHINE_ID_RC_ONCE && RUNTIME
+ select UTIL_LINUX_NG if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
+ select UTIL_LINUX_NG_UUIDGEN if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
help
Enable this to make sure there is always a unique /etc/machine-id
available in the system.
+
+if MACHINE_ID
+
+config MACHINE_ID_RC_ONCE
+ bool "generate (bbinit) or save (systemd) machine-id using rc-once at first boot"
+ default y
+ help
+ If not set only an empty /etc/machine-id will be installed.
+ Systemd:
+ If /etc/machine-id exists and is empty, systemd will bind-mount
+ a file containing the new machine-id over it and later try
+ to commit it to disk (if /etc/ is writable).
+
+endif
diff --git a/rules/machine-id.make b/rules/machine-id.make
index 3883d64cb..5d66829da 100644
--- a/rules/machine-id.make
+++ b/rules/machine-id.make
@@ -27,7 +27,11 @@ $(STATEDIR)/machine-id.targetinstall:
@$(call install_fixup,machine-id,AUTHOR,"Michael Olbrich <m.olbrich@pengutronix.de>")
@$(call install_fixup,machine-id,DESCRIPTION,missing)
+ @$(call install_alternative, machine-id, 0, 0, 0444, /etc/machine-id)
+
+ifdef MACHINE_ID_RC_ONCE
@$(call install_alternative, machine-id, 0, 0, 0755, /etc/rc.once.d/machine-id)
+endif
@$(call install_finish,machine-id)
diff --git a/rules/machine-id.postinst b/rules/machine-id.postinst
index 2060129d1..f1648226b 100644
--- a/rules/machine-id.postinst
+++ b/rules/machine-id.postinst
@@ -1,3 +1,4 @@
#!/bin/sh
-touch "$DESTDIR/etc/machine-id"
-$DESTDIR/usr/sbin/enable-rc-once machine-id
+if [ -f $DESTDIR/etc/rc.once.d/machine-id ]; then
+ $DESTDIR/usr/sbin/enable-rc-once machine-id
+fi
--
2.29.2
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] machine-id: make using rc-once optional
2020-11-30 10:42 [ptxdist] [PATCH] machine-id: make using rc-once optional Artur Wiebe
@ 2020-12-04 6:32 ` Michael Olbrich
2020-12-04 9:33 ` [ptxdist] ?==?utf-8?q? ?==?utf-8?q? " Artur Wiebe
0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2020-12-04 6:32 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
On Mon, Nov 30, 2020 at 11:42:54AM +0100, Artur Wiebe wrote:
> If not set only an empty /etc/machine-id will be installed.
I'm ok with keeping the prompt for MACHINE_ID_RC_ONCE, but you have ignored
all my other review as well. That still needs to be fixed.
Michael
>
> Signed-off-by: Artur Wiebe <artur@4wiebe.de>
> ---
> projectroot/etc/machine-id | 0
> rules/machine-id.in | 22 ++++++++++++++++++----
> rules/machine-id.make | 4 ++++
> rules/machine-id.postinst | 5 +++--
> 4 files changed, 25 insertions(+), 6 deletions(-)
> create mode 100644 projectroot/etc/machine-id
>
> diff --git a/projectroot/etc/machine-id b/projectroot/etc/machine-id
> new file mode 100644
> index 000000000..e69de29bb
> diff --git a/rules/machine-id.in b/rules/machine-id.in
> index f18fec554..2a3901f41 100644
> --- a/rules/machine-id.in
> +++ b/rules/machine-id.in
> @@ -1,11 +1,25 @@
> ## SECTION=initmethod
>
> -config MACHINE_ID
> +menuconfig MACHINE_ID
> tristate
> prompt "create /etc/machine-id"
> - select RC_ONCE if RUNTIME
> - select UTIL_LINUX_NG if !INITMETHOD_SYSTEMD
> - select UTIL_LINUX_NG_UUIDGEN if !INITMETHOD_SYSTEMD
> + select RC_ONCE if MACHINE_ID_RC_ONCE && RUNTIME
> + select UTIL_LINUX_NG if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
> + select UTIL_LINUX_NG_UUIDGEN if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
> help
> Enable this to make sure there is always a unique /etc/machine-id
> available in the system.
> +
> +if MACHINE_ID
> +
> +config MACHINE_ID_RC_ONCE
> + bool "generate (bbinit) or save (systemd) machine-id using rc-once at first boot"
> + default y
> + help
> + If not set only an empty /etc/machine-id will be installed.
> + Systemd:
> + If /etc/machine-id exists and is empty, systemd will bind-mount
> + a file containing the new machine-id over it and later try
> + to commit it to disk (if /etc/ is writable).
> +
> +endif
> diff --git a/rules/machine-id.make b/rules/machine-id.make
> index 3883d64cb..5d66829da 100644
> --- a/rules/machine-id.make
> +++ b/rules/machine-id.make
> @@ -27,7 +27,11 @@ $(STATEDIR)/machine-id.targetinstall:
> @$(call install_fixup,machine-id,AUTHOR,"Michael Olbrich <m.olbrich@pengutronix.de>")
> @$(call install_fixup,machine-id,DESCRIPTION,missing)
>
> + @$(call install_alternative, machine-id, 0, 0, 0444, /etc/machine-id)
> +
> +ifdef MACHINE_ID_RC_ONCE
> @$(call install_alternative, machine-id, 0, 0, 0755, /etc/rc.once.d/machine-id)
> +endif
>
> @$(call install_finish,machine-id)
>
> diff --git a/rules/machine-id.postinst b/rules/machine-id.postinst
> index 2060129d1..f1648226b 100644
> --- a/rules/machine-id.postinst
> +++ b/rules/machine-id.postinst
> @@ -1,3 +1,4 @@
> #!/bin/sh
> -touch "$DESTDIR/etc/machine-id"
> -$DESTDIR/usr/sbin/enable-rc-once machine-id
> +if [ -f $DESTDIR/etc/rc.once.d/machine-id ]; then
> + $DESTDIR/usr/sbin/enable-rc-once machine-id
> +fi
> --
> 2.29.2
>
>
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] ?==?utf-8?q? ?==?utf-8?q? [PATCH] machine-id: make using rc-once optional
2020-12-04 6:32 ` Michael Olbrich
@ 2020-12-04 9:33 ` Artur Wiebe
0 siblings, 0 replies; 7+ messages in thread
From: Artur Wiebe @ 2020-12-04 9:33 UTC (permalink / raw)
To: ptxdist
Hi Michael,
sorry, I misunderstood some parts of your review on the first reading.
I think the new patch does what you suggested.
Artur
On Friday, December 04, 2020 07:32 CET, Michael Olbrich <m.olbrich@pengutronix.de> wrote:
> On Mon, Nov 30, 2020 at 11:42:54AM +0100, Artur Wiebe wrote:
> > If not set only an empty /etc/machine-id will be installed.
>
> I'm ok with keeping the prompt for MACHINE_ID_RC_ONCE, but you have ignored
> all my other review as well. That still needs to be fixed.
>
> Michael
>
> >
> > Signed-off-by: Artur Wiebe <artur@4wiebe.de>
> > ---
> > projectroot/etc/machine-id | 0
> > rules/machine-id.in | 22 ++++++++++++++++++----
> > rules/machine-id.make | 4 ++++
> > rules/machine-id.postinst | 5 +++--
> > 4 files changed, 25 insertions(+), 6 deletions(-)
> > create mode 100644 projectroot/etc/machine-id
> >
> > diff --git a/projectroot/etc/machine-id b/projectroot/etc/machine-id
> > new file mode 100644
> > index 000000000..e69de29bb
> > diff --git a/rules/machine-id.in b/rules/machine-id.in
> > index f18fec554..2a3901f41 100644
> > --- a/rules/machine-id.in
> > +++ b/rules/machine-id.in
> > @@ -1,11 +1,25 @@
> > ## SECTION=initmethod
> >
> > -config MACHINE_ID
> > +menuconfig MACHINE_ID
> > tristate
> > prompt "create /etc/machine-id"
> > - select RC_ONCE if RUNTIME
> > - select UTIL_LINUX_NG if !INITMETHOD_SYSTEMD
> > - select UTIL_LINUX_NG_UUIDGEN if !INITMETHOD_SYSTEMD
> > + select RC_ONCE if MACHINE_ID_RC_ONCE && RUNTIME
> > + select UTIL_LINUX_NG if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
> > + select UTIL_LINUX_NG_UUIDGEN if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
> > help
> > Enable this to make sure there is always a unique /etc/machine-id
> > available in the system.
> > +
> > +if MACHINE_ID
> > +
> > +config MACHINE_ID_RC_ONCE
> > + bool "generate (bbinit) or save (systemd) machine-id using rc-once at first boot"
> > + default y
> > + help
> > + If not set only an empty /etc/machine-id will be installed.
> > + Systemd:
> > + If /etc/machine-id exists and is empty, systemd will bind-mount
> > + a file containing the new machine-id over it and later try
> > + to commit it to disk (if /etc/ is writable).
> > +
> > +endif
> > diff --git a/rules/machine-id.make b/rules/machine-id.make
> > index 3883d64cb..5d66829da 100644
> > --- a/rules/machine-id.make
> > +++ b/rules/machine-id.make
> > @@ -27,7 +27,11 @@ $(STATEDIR)/machine-id.targetinstall:
> > @$(call install_fixup,machine-id,AUTHOR,"Michael Olbrich <m.olbrich@pengutronix.de>")
> > @$(call install_fixup,machine-id,DESCRIPTION,missing)
> >
> > + @$(call install_alternative, machine-id, 0, 0, 0444, /etc/machine-id)
> > +
> > +ifdef MACHINE_ID_RC_ONCE
> > @$(call install_alternative, machine-id, 0, 0, 0755, /etc/rc.once.d/machine-id)
> > +endif
> >
> > @$(call install_finish,machine-id)
> >
> > diff --git a/rules/machine-id.postinst b/rules/machine-id.postinst
> > index 2060129d1..f1648226b 100644
> > --- a/rules/machine-id.postinst
> > +++ b/rules/machine-id.postinst
> > @@ -1,3 +1,4 @@
> > #!/bin/sh
> > -touch "$DESTDIR/etc/machine-id"
> > -$DESTDIR/usr/sbin/enable-rc-once machine-id
> > +if [ -f $DESTDIR/etc/rc.once.d/machine-id ]; then
> > + $DESTDIR/usr/sbin/enable-rc-once machine-id
> > +fi
> > --
> > 2.29.2
> >
> >
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de
> > To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> >
>
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ptxdist] [PATCH] machine-id: make using rc-once optional
@ 2020-12-04 9:30 Artur Wiebe
0 siblings, 0 replies; 7+ messages in thread
From: Artur Wiebe @ 2020-12-04 9:30 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
If not set /etc/machine-id will be installed from projectroot (default: empty file).
Signed-off-by: Artur Wiebe <artur@4wiebe.de>
---
projectroot/etc/machine-id | 0
rules/machine-id.in | 23 +++++++++++++++++++----
rules/machine-id.make | 4 ++++
rules/machine-id.postinst | 6 ++++--
4 files changed, 27 insertions(+), 6 deletions(-)
create mode 100644 projectroot/etc/machine-id
diff --git a/projectroot/etc/machine-id b/projectroot/etc/machine-id
new file mode 100644
index 000000000..e69de29bb
diff --git a/rules/machine-id.in b/rules/machine-id.in
index f18fec554..36fa0f6df 100644
--- a/rules/machine-id.in
+++ b/rules/machine-id.in
@@ -1,11 +1,26 @@
## SECTION=initmethod
-config MACHINE_ID
+menuconfig MACHINE_ID
tristate
prompt "create /etc/machine-id"
- select RC_ONCE if RUNTIME
- select UTIL_LINUX_NG if !INITMETHOD_SYSTEMD
- select UTIL_LINUX_NG_UUIDGEN if !INITMETHOD_SYSTEMD
+ select RC_ONCE if MACHINE_ID_RC_ONCE && RUNTIME
+ select UTIL_LINUX_NG if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
+ select UTIL_LINUX_NG_UUIDGEN if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
help
Enable this to make sure there is always a unique /etc/machine-id
available in the system.
+
+if MACHINE_ID
+
+config MACHINE_ID_RC_ONCE
+ bool "generate (bbinit) or save (systemd) machine-id using rc-once at first boot"
+ default y
+ help
+ If not set /etc/machine-id will be installed from projectroot
+ (default: empty file).
+ Systemd:
+ If /etc/machine-id exists and is empty, systemd will bind-mount
+ a file containing the new machine-id over it and later try
+ to commit it to disk (if /etc/ is writable).
+
+endif
diff --git a/rules/machine-id.make b/rules/machine-id.make
index 3883d64cb..50e9b99ee 100644
--- a/rules/machine-id.make
+++ b/rules/machine-id.make
@@ -27,7 +27,11 @@ $(STATEDIR)/machine-id.targetinstall:
@$(call install_fixup,machine-id,AUTHOR,"Michael Olbrich <m.olbrich@pengutronix.de>")
@$(call install_fixup,machine-id,DESCRIPTION,missing)
+ifdef PTXCONF_MACHINE_ID_RC_ONCE
@$(call install_alternative, machine-id, 0, 0, 0755, /etc/rc.once.d/machine-id)
+else
+ @$(call install_alternative, machine-id, 0, 0, 0444, /etc/machine-id)
+endif
@$(call install_finish,machine-id)
diff --git a/rules/machine-id.postinst b/rules/machine-id.postinst
index 2060129d1..208f7b4b8 100644
--- a/rules/machine-id.postinst
+++ b/rules/machine-id.postinst
@@ -1,3 +1,5 @@
#!/bin/sh
-touch "$DESTDIR/etc/machine-id"
-$DESTDIR/usr/sbin/enable-rc-once machine-id
+if [ -f $DESTDIR/etc/rc.once.d/machine-id ]; then
+ touch "$DESTDIR/etc/machine-id"
+ $DESTDIR/usr/sbin/enable-rc-once machine-id
+fi
--
2.29.2
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] machine-id: make using rc-once optional
2020-11-27 8:38 ` Michael Olbrich
@ 2020-11-27 11:02 ` Ladislav Michl
0 siblings, 0 replies; 7+ messages in thread
From: Ladislav Michl @ 2020-11-27 11:02 UTC (permalink / raw)
To: ptxdist
On Fri, Nov 27, 2020 at 09:38:41AM +0100, Michael Olbrich wrote:
> On Wed, Nov 25, 2020 at 05:56:49PM +0100, Artur Wiebe wrote:
> > If not set only an empty /etc/machine-id will be installed.
> >
> > Signed-off-by: Artur Wiebe <artur@4wiebe.de>
> > ---
> > rules/machine-id.in | 22 ++++++++++++++++++----
> > rules/machine-id.make | 4 ++++
> > rules/machine-id.postinst | 5 +++--
> > 3 files changed, 25 insertions(+), 6 deletions(-)
> >
> > diff --git a/rules/machine-id.in b/rules/machine-id.in
> > index f18fec554..2a3901f41 100644
> > --- a/rules/machine-id.in
> > +++ b/rules/machine-id.in
> > @@ -1,11 +1,25 @@
> > ## SECTION=initmethod
> >
> > -config MACHINE_ID
> > +menuconfig MACHINE_ID
> > tristate
> > prompt "create /etc/machine-id"
> > - select RC_ONCE if RUNTIME
> > - select UTIL_LINUX_NG if !INITMETHOD_SYSTEMD
> > - select UTIL_LINUX_NG_UUIDGEN if !INITMETHOD_SYSTEMD
> > + select RC_ONCE if MACHINE_ID_RC_ONCE && RUNTIME
> > + select UTIL_LINUX_NG if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
> > + select UTIL_LINUX_NG_UUIDGEN if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
> > help
> > Enable this to make sure there is always a unique /etc/machine-id
> > available in the system.
> > +
> > +if MACHINE_ID
> > +
> > +config MACHINE_ID_RC_ONCE
> > + bool "generate (bbinit) or save (systemd) machine-id using rc-once at first boot"
> > + default y
>
> Hmmm, maybe should have no prompt and 'depends on RC_ONCE' (instead of
> selecting it above). I don't think there is a use-case for not persisting
> the machine-id if rc-once is available.
Well, one of my systems has a service for that. Machine-id is generated using
hardware info. In that case I do not mind as RC_ONCE is not selected, but there
is a use-case in general. However it is still possible to override
rules/machine-id.in in BSP, so...
> This is different from the ssh server key case: There are other ways to
> create the keys.
There are other ways to create machine-id too...
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [ptxdist] [PATCH] machine-id: make using rc-once optional
2020-11-25 16:56 Artur Wiebe
@ 2020-11-27 8:38 ` Michael Olbrich
2020-11-27 11:02 ` Ladislav Michl
0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2020-11-27 8:38 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
On Wed, Nov 25, 2020 at 05:56:49PM +0100, Artur Wiebe wrote:
> If not set only an empty /etc/machine-id will be installed.
>
> Signed-off-by: Artur Wiebe <artur@4wiebe.de>
> ---
> rules/machine-id.in | 22 ++++++++++++++++++----
> rules/machine-id.make | 4 ++++
> rules/machine-id.postinst | 5 +++--
> 3 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/rules/machine-id.in b/rules/machine-id.in
> index f18fec554..2a3901f41 100644
> --- a/rules/machine-id.in
> +++ b/rules/machine-id.in
> @@ -1,11 +1,25 @@
> ## SECTION=initmethod
>
> -config MACHINE_ID
> +menuconfig MACHINE_ID
> tristate
> prompt "create /etc/machine-id"
> - select RC_ONCE if RUNTIME
> - select UTIL_LINUX_NG if !INITMETHOD_SYSTEMD
> - select UTIL_LINUX_NG_UUIDGEN if !INITMETHOD_SYSTEMD
> + select RC_ONCE if MACHINE_ID_RC_ONCE && RUNTIME
> + select UTIL_LINUX_NG if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
> + select UTIL_LINUX_NG_UUIDGEN if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
> help
> Enable this to make sure there is always a unique /etc/machine-id
> available in the system.
> +
> +if MACHINE_ID
> +
> +config MACHINE_ID_RC_ONCE
> + bool "generate (bbinit) or save (systemd) machine-id using rc-once at first boot"
> + default y
Hmmm, maybe should have no prompt and 'depends on RC_ONCE' (instead of
selecting it above). I don't think there is a use-case for not persisting
the machine-id if rc-once is available.
This is different from the ssh server key case: There are other ways to
create the keys.
> + help
> + If not set only an empty /etc/machine-id will be installed.
> + Systemd:
> + If /etc/machine-id exists and is empty, systemd will bind-mount
> + a file containing the new machine-id over it and later try
> + to commit it to disk (if /etc/ is writable).
> +
> +endif
> diff --git a/rules/machine-id.make b/rules/machine-id.make
> index 3883d64cb..e1cbdcc42 100644
> --- a/rules/machine-id.make
> +++ b/rules/machine-id.make
> @@ -27,7 +27,11 @@ $(STATEDIR)/machine-id.targetinstall:
> @$(call install_fixup,machine-id,AUTHOR,"Michael Olbrich <m.olbrich@pengutronix.de>")
> @$(call install_fixup,machine-id,DESCRIPTION,missing)
>
> + @$(call install_copy, machine-id, 0, 0, 0644, /dev/null, /etc/machine-id)
Maybe install_alternative and an empty on in projectroot/. Sometimes it's
better to share the same machine-id across devices than having a new one
after rebooting.
Also, this should only happen for !PTXCONF_MACHINE_ID_RC_ONCE. It's not a
good idea to modify files that are installed by a package.
> +
> +ifdef MACHINE_ID_RC_ONCE
ifdef PTXCONF_MACHINE_ID_RC_ONCE
> @$(call install_alternative, machine-id, 0, 0, 0755, /etc/rc.once.d/machine-id)
> +endif
>
> @$(call install_finish,machine-id)
>
> diff --git a/rules/machine-id.postinst b/rules/machine-id.postinst
> index 2060129d1..f1648226b 100644
> --- a/rules/machine-id.postinst
> +++ b/rules/machine-id.postinst
> @@ -1,3 +1,4 @@
> #!/bin/sh
> -touch "$DESTDIR/etc/machine-id"
So this is still needed inside the 'if'.
Michael
> -$DESTDIR/usr/sbin/enable-rc-once machine-id
> +if [ -f $DESTDIR/etc/rc.once.d/machine-id ]; then
> + $DESTDIR/usr/sbin/enable-rc-once machine-id
> +fi
> --
> 2.29.2
>
>
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
>
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ptxdist] [PATCH] machine-id: make using rc-once optional
@ 2020-11-25 16:56 Artur Wiebe
2020-11-27 8:38 ` Michael Olbrich
0 siblings, 1 reply; 7+ messages in thread
From: Artur Wiebe @ 2020-11-25 16:56 UTC (permalink / raw)
To: ptxdist; +Cc: Artur Wiebe
If not set only an empty /etc/machine-id will be installed.
Signed-off-by: Artur Wiebe <artur@4wiebe.de>
---
rules/machine-id.in | 22 ++++++++++++++++++----
rules/machine-id.make | 4 ++++
rules/machine-id.postinst | 5 +++--
3 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/rules/machine-id.in b/rules/machine-id.in
index f18fec554..2a3901f41 100644
--- a/rules/machine-id.in
+++ b/rules/machine-id.in
@@ -1,11 +1,25 @@
## SECTION=initmethod
-config MACHINE_ID
+menuconfig MACHINE_ID
tristate
prompt "create /etc/machine-id"
- select RC_ONCE if RUNTIME
- select UTIL_LINUX_NG if !INITMETHOD_SYSTEMD
- select UTIL_LINUX_NG_UUIDGEN if !INITMETHOD_SYSTEMD
+ select RC_ONCE if MACHINE_ID_RC_ONCE && RUNTIME
+ select UTIL_LINUX_NG if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
+ select UTIL_LINUX_NG_UUIDGEN if MACHINE_ID_RC_ONCE && !INITMETHOD_SYSTEMD
help
Enable this to make sure there is always a unique /etc/machine-id
available in the system.
+
+if MACHINE_ID
+
+config MACHINE_ID_RC_ONCE
+ bool "generate (bbinit) or save (systemd) machine-id using rc-once at first boot"
+ default y
+ help
+ If not set only an empty /etc/machine-id will be installed.
+ Systemd:
+ If /etc/machine-id exists and is empty, systemd will bind-mount
+ a file containing the new machine-id over it and later try
+ to commit it to disk (if /etc/ is writable).
+
+endif
diff --git a/rules/machine-id.make b/rules/machine-id.make
index 3883d64cb..e1cbdcc42 100644
--- a/rules/machine-id.make
+++ b/rules/machine-id.make
@@ -27,7 +27,11 @@ $(STATEDIR)/machine-id.targetinstall:
@$(call install_fixup,machine-id,AUTHOR,"Michael Olbrich <m.olbrich@pengutronix.de>")
@$(call install_fixup,machine-id,DESCRIPTION,missing)
+ @$(call install_copy, machine-id, 0, 0, 0644, /dev/null, /etc/machine-id)
+
+ifdef MACHINE_ID_RC_ONCE
@$(call install_alternative, machine-id, 0, 0, 0755, /etc/rc.once.d/machine-id)
+endif
@$(call install_finish,machine-id)
diff --git a/rules/machine-id.postinst b/rules/machine-id.postinst
index 2060129d1..f1648226b 100644
--- a/rules/machine-id.postinst
+++ b/rules/machine-id.postinst
@@ -1,3 +1,4 @@
#!/bin/sh
-touch "$DESTDIR/etc/machine-id"
-$DESTDIR/usr/sbin/enable-rc-once machine-id
+if [ -f $DESTDIR/etc/rc.once.d/machine-id ]; then
+ $DESTDIR/usr/sbin/enable-rc-once machine-id
+fi
--
2.29.2
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-12-04 9:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 10:42 [ptxdist] [PATCH] machine-id: make using rc-once optional Artur Wiebe
2020-12-04 6:32 ` Michael Olbrich
2020-12-04 9:33 ` [ptxdist] ?==?utf-8?q? ?==?utf-8?q? " Artur Wiebe
-- strict thread matches above, loose matches on Subject: below --
2020-12-04 9:30 [ptxdist] " Artur Wiebe
2020-11-25 16:56 Artur Wiebe
2020-11-27 8:38 ` Michael Olbrich
2020-11-27 11:02 ` Ladislav Michl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox