Refactor 02-set-machine-id into an element
This script is needlessly duplicated across 3 elements. This change consolidates those. Assisted-By: Opencode - Claude Sonnet 4.6 Signed-off-by: Steve Baker <sbaker@redhat.com> Change-Id: I8183931b1b962b7916265e3b5c3ea1175bd57c4d
This commit is contained in:
1 parent
73764519c2
commit
1af83478ce
7 files changed
+21
-43
No files matched your search
@@ -2,4 +2,5 @@ cache-url
|
||||
redhat-common
|
||||
rpm-distro
|
||||
source-repositories
|
||||
systemd-machine-id
|
||||
yum
|
||||
@@ -3,4 +3,5 @@ dkms
|
||||
redhat-common
|
||||
rpm-distro
|
||||
source-repositories
|
||||
systemd-machine-id
|
||||
yum
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# The systemd .spec file does this in %post [1] and it turns out that
|
||||
# (in what is possibly a bug [2]) that kernel install requires
|
||||
# /etc/machine-id. This affects "fedora" (the image-based build) if
|
||||
# there is no systemd update to install ... with "fedora-minimal" we
|
||||
# are always installing into the chroot so, so %post always runs and
|
||||
# this is always run
|
||||
#
|
||||
# [1] https://src.fedoraproject.org/rpms/systemd/blob/master/f/systemd.spec
|
||||
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=1486124
|
||||
|
||||
systemd-machine-id-setup
|
||||
@@ -3,4 +3,5 @@ redhat-common
|
||||
rhel-common
|
||||
rpm-distro
|
||||
source-repositories
|
||||
systemd-machine-id
|
||||
yum
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
||||
set -x
|
||||
fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# Set a machine-id. The .qcow2 image doesn't have one, and sometimes
|
||||
# one will get made (if systemd is upgraded as part of the build
|
||||
# process) and sometimes not. The problem is that certain kernel
|
||||
# install scripts bail silently without it; kernel packages end up
|
||||
# being installed but the initramfs etc isn't copied into place.
|
||||
#
|
||||
# Note this is cleared out in the sysprep role.
|
||||
#
|
||||
# See also:
|
||||
# 768c5e188c1b4bff01da14a49b96b51301db4c03 : similar thing for fedora
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1737355 : upstream bug
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1486124 : unresolved
|
||||
# bug about kernel install requiring machine-id
|
||||
|
||||
systemd-machine-id-setup
|
||||
@@ -0,0 +1,17 @@
|
||||
==================
|
||||
systemd-machine-id
|
||||
==================
|
||||
|
||||
Initialises ``/etc/machine-id`` during image build by running
|
||||
``systemd-machine-id-setup`` in the pre-install phase.
|
||||
|
||||
Image-based builds (e.g. from a qcow2 or tarball) may not have a
|
||||
machine-id present. One may also be absent when systemd has not yet
|
||||
been upgraded as part of the build. Certain kernel install scripts
|
||||
check for ``/etc/machine-id`` and bail silently when it is missing,
|
||||
leaving kernel packages installed but without an initramfs or kernel
|
||||
copied into place.
|
||||
|
||||
The machine-id set here is a temporary build-time value. It is
|
||||
cleared by the ``sysprep`` element so that each deployed instance
|
||||
receives a unique id on first boot.
|
||||
+1
-1
@@ -6,7 +6,7 @@ fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# Set a machine-id. The .qcow2 image doesn't have one, and sometimes
|
||||
# Set a machine-id. Image-based builds may not have one, and sometimes
|
||||
# one will get made (if systemd is upgraded as part of the build
|
||||
# process) and sometimes not. The problem is that certain kernel
|
||||
# install scripts bail silently without it; kernel packages end up
|
||||
Reference in new issue
Block a user