From 7811be6b3aca1242a9663b416acbd5d22a5ad513e089b96236ae74b40b1a60e5 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Wed, 15 Mar 2017 07:16:24 +0000 Subject: [PATCH] Accepting request 479267 from home:fbui:systemd:Factory - Initialize /etc/machine-id during the first boot (bsc#1024740) Previously that was done at package installation but it didn't fit well for appliance builds. OBS-URL: https://build.opensuse.org/request/show/479267 OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=974 --- systemd-mini.changes | 8 ++++++++ systemd-mini.spec | 12 +++++++++++- systemd.changes | 8 ++++++++ systemd.spec | 12 +++++++++++- 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/systemd-mini.changes b/systemd-mini.changes index aaafd423..c5fb2402 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Mar 14 14:13:56 UTC 2017 - fbui@suse.com + +- Initialize /etc/machine-id during the first boot (bsc#1024740) + + Previously that was done at package installation but it didn't fit + well for appliance builds. + ------------------------------------------------------------------- Tue Mar 7 09:22:30 UTC 2017 - fbui@suse.com diff --git a/systemd-mini.spec b/systemd-mini.spec index 395e85ee..03d57366 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -646,13 +646,23 @@ cat %{S:14} >>%{buildroot}%{_datarootdir}/systemd/kbd-model-map exit 0 %post +# Make /etc/machine-id an empty file during package installation. On +# the first boot, machine-id is initialized and either committed (if +# /etc/ is writable) or the system/image runs with a transient machine +# ID, that changes on each boot (if the image is read-only). This is +# especially important for appliance builds to avoid an identical +# machine ID in all images. +if [ $1 -eq 1 ]; then + touch %{_sysconfdir}/machine-id + chmod 666 %{_sysconfdir}/machine-id +fi + %sysusers_create /usr/lib/sysusers.d/systemd.conf %if ! 0%{?bootstrap} pam-config -a --systemd || : %endif ldconfig [ -e %{_localstatedir}/lib/random-seed ] && mv %{_localstatedir}/lib/random-seed %{_localstatedir}/lib/systemd/ || : -systemd-machine-id-setup || : /usr/lib/systemd/systemd-random-seed save || : systemctl daemon-reexec || : %journal_catalog_update diff --git a/systemd.changes b/systemd.changes index aaafd423..c5fb2402 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Mar 14 14:13:56 UTC 2017 - fbui@suse.com + +- Initialize /etc/machine-id during the first boot (bsc#1024740) + + Previously that was done at package installation but it didn't fit + well for appliance builds. + ------------------------------------------------------------------- Tue Mar 7 09:22:30 UTC 2017 - fbui@suse.com diff --git a/systemd.spec b/systemd.spec index ec08a56d..c5f443c7 100644 --- a/systemd.spec +++ b/systemd.spec @@ -644,13 +644,23 @@ cat %{S:14} >>%{buildroot}%{_datarootdir}/systemd/kbd-model-map exit 0 %post +# Make /etc/machine-id an empty file during package installation. On +# the first boot, machine-id is initialized and either committed (if +# /etc/ is writable) or the system/image runs with a transient machine +# ID, that changes on each boot (if the image is read-only). This is +# especially important for appliance builds to avoid an identical +# machine ID in all images. +if [ $1 -eq 1 ]; then + touch %{_sysconfdir}/machine-id + chmod 666 %{_sysconfdir}/machine-id +fi + %sysusers_create /usr/lib/sysusers.d/systemd.conf %if ! 0%{?bootstrap} pam-config -a --systemd || : %endif ldconfig [ -e %{_localstatedir}/lib/random-seed ] && mv %{_localstatedir}/lib/random-seed %{_localstatedir}/lib/systemd/ || : -systemd-machine-id-setup || : /usr/lib/systemd/systemd-random-seed save || : systemctl daemon-reexec || : %journal_catalog_update