ryantimwilson / rpms / systemd

Forked from rpms/systemd 6 days ago
Clone
2aacef
From 89adb54468aff192fccc9dce793e24d98b26d994 Mon Sep 17 00:00:00 2001
2aacef
From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= <marcus.schaefer@gmail.com>
2aacef
Date: Wed, 16 Nov 2022 16:25:08 +0100
2aacef
Subject: [PATCH] Handle MACHINE_ID=uninitialized
2aacef
2aacef
systemd supports /etc/machine-id to be set to: uninitialized
2aacef
In this case the expectation is that systemd creates a new
2aacef
machine ID and replaces the value 'uninitialized' with the
2aacef
effective machine id. In the scope of kernel-install we
2aacef
should also enforce the creation of a new machine id in this
2aacef
condition
2aacef
2aacef
(cherry picked from commit 305dd91adfde332e7e5c1b2470edb32774f9a032)
2aacef
2aacef
Related: #2138081
2aacef
---
2aacef
 src/kernel-install/kernel-install.in | 1 +
2aacef
 1 file changed, 1 insertion(+)
2aacef
2aacef
diff --git a/src/kernel-install/kernel-install.in b/src/kernel-install/kernel-install.in
2aacef
index bba22f8a20..fa2c0d5276 100755
2aacef
--- a/src/kernel-install/kernel-install.in
2aacef
+++ b/src/kernel-install/kernel-install.in
2aacef
@@ -160,6 +160,7 @@ if [ -z "$MACHINE_ID" ] && [ -f /etc/machine-info ]; then
2aacef
 fi
2aacef
 if [ -z "$MACHINE_ID" ] && [ -s /etc/machine-id ]; then
2aacef
     read -r MACHINE_ID 
2aacef
+    [ "$MACHINE_ID" = "uninitialized" ] && unset MACHINE_ID
2aacef
     [ -n "$MACHINE_ID" ] && \
2aacef
         log_verbose "machine-id $MACHINE_ID acquired from /etc/machine-id"
2aacef
 fi