|
|
8d419f |
From 5eb855bddaf8270e7274132ded0e36325d8ffbbe Mon Sep 17 00:00:00 2001
|
|
|
8d419f |
From: Lennart Poettering <lennart@poettering.net>
|
|
|
8d419f |
Date: Wed, 9 Feb 2022 14:44:48 +0100
|
|
|
8d419f |
Subject: [PATCH] kernel-install: only generate systemd.boot_id= in kernel
|
|
|
8d419f |
command line if used for naming the boot loader spec files/dirs
|
|
|
8d419f |
|
|
|
8d419f |
Now that we can distinguish the naming of the boot loader spec
|
|
|
8d419f |
dirs/files and the machine ID let's tweak the logic for suffixing the
|
|
|
8d419f |
kernel cmdline with systemd.boot_id=: let's only do that when we
|
|
|
8d419f |
actually need the boot ID for naming these dirs/files. If we don't,
|
|
|
8d419f |
let's not bother.
|
|
|
8d419f |
|
|
|
8d419f |
This should be beneficial for "golden" images that shall not carry any
|
|
|
8d419f |
machine IDs at all, i.e acquire their identity only once the final
|
|
|
8d419f |
userspace is actually reached.
|
|
|
8d419f |
|
|
|
8d419f |
(cherry picked from commit 953b61004c37948dcd897265b56c1613bc73b9f9)
|
|
|
8d419f |
|
|
|
8d419f |
Related: #2065061
|
|
|
8d419f |
---
|
|
|
8d419f |
src/kernel-install/90-loaderentry.install | 18 +++++++++++++-----
|
|
|
8d419f |
1 file changed, 13 insertions(+), 5 deletions(-)
|
|
|
8d419f |
|
|
|
8d419f |
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
|
|
|
8d419f |
index 46261a2c11..c1d69aa824 100644
|
|
|
8d419f |
--- a/src/kernel-install/90-loaderentry.install
|
|
|
8d419f |
+++ b/src/kernel-install/90-loaderentry.install
|
|
|
8d419f |
@@ -70,10 +70,15 @@ else
|
|
|
8d419f |
BOOT_OPTIONS="$(tr -s "$IFS" '\n'
|
|
|
8d419f |
fi
|
|
|
8d419f |
|
|
|
8d419f |
-# Suffix with the machine ID we use, so that the machine ID remains stable,
|
|
|
8d419f |
-# even during factory reset, in the initrd (where the system's machine ID is
|
|
|
8d419f |
-# not directly accessible yet), and if the root file system is volatile.
|
|
|
8d419f |
-BOOT_OPTIONS="${BOOT_OPTIONS% } systemd.machine_id=$MACHINE_ID"
|
|
|
8d419f |
+BOOT_OPTIONS="${BOOT_OPTIONS% }"
|
|
|
8d419f |
+
|
|
|
8d419f |
+# If the boot entries are named after the machine ID, then suffix the kernel
|
|
|
8d419f |
+# command line with the machine ID we use, so that the machine ID remains
|
|
|
8d419f |
+# stable, even during factory reset, in the initrd (where the system's machine
|
|
|
8d419f |
+# ID is not directly accessible yet), and if the root file system is volatile.
|
|
|
8d419f |
+if [ "$ENTRY_TOKEN" = "$MACHINE_ID" ]; then
|
|
|
8d419f |
+ BOOT_OPTIONS="$BOOT_OPTIONS systemd.machine_id=$MACHINE_ID"
|
|
|
8d419f |
+fi
|
|
|
8d419f |
|
|
|
8d419f |
if [ -r /etc/kernel/tries ]; then
|
|
|
8d419f |
read -r TRIES
|
|
|
8d419f |
@@ -121,7 +126,10 @@ mkdir -p "${LOADER_ENTRY%/*}" || {
|
|
|
8d419f |
{
|
|
|
8d419f |
echo "title $PRETTY_NAME"
|
|
|
8d419f |
echo "version $KERNEL_VERSION"
|
|
|
8d419f |
- echo "machine-id $MACHINE_ID"
|
|
|
8d419f |
+ if [ "$ENTRY_TOKEN" = "$MACHINE_ID" ]; then
|
|
|
8d419f |
+ # See similar logic above for the systemd.machine_id= kernel command line option
|
|
|
8d419f |
+ echo "machine-id $MACHINE_ID"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
echo "options $BOOT_OPTIONS"
|
|
|
8d419f |
echo "linux $ENTRY_DIR/linux"
|
|
|
8d419f |
|