]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
kernel-install/90-loaderentry: do not add multiple systemd.machine_id options
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Fri, 4 Nov 2022 08:57:24 +0000 (09:57 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 4 Nov 2022 15:53:40 +0000 (16:53 +0100)
Do not unconditionally add a new systemd.machine_id command line option, first
check if it already exists with the expected value.

Fixes #25203

src/kernel-install/90-loaderentry.install

index 743af33aa9345269f7e53a02333290cfd365a5db..ea75e1b0d8d4f44fec25a7bd4716d9cc27364359 100755 (executable)
@@ -85,7 +85,7 @@ BOOT_OPTIONS="${BOOT_OPTIONS% }"
 # command line with the machine ID we use, so that the machine ID remains
 # stable, even during factory reset, in the initrd (where the system's machine
 # ID is not directly accessible yet), and if the root file system is volatile.
-if [ "$ENTRY_TOKEN" = "$MACHINE_ID" ]; then
+if [ "$ENTRY_TOKEN" = "$MACHINE_ID" ] && ! echo "$BOOT_OPTIONS" | grep -q "systemd.machine_id=$MACHINE_ID"; then
     BOOT_OPTIONS="$BOOT_OPTIONS systemd.machine_id=$MACHINE_ID"
 fi