]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Handle MACHINE_ID=uninitialized
authorMarcus Schäfer <marcus.schaefer@gmail.com>
Wed, 16 Nov 2022 15:25:08 +0000 (16:25 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 16 Nov 2022 22:45:25 +0000 (07:45 +0900)
systemd supports /etc/machine-id to be set to: uninitialized
In this case the expectation is that systemd creates a new
machine ID and replaces the value 'uninitialized' with the
effective machine id. In the scope of kernel-install we
should also enforce the creation of a new machine id in this
condition

src/kernel-install/kernel-install.in

index bba22f8a206326c540c399cd6e7a9c4b6f02febc..fa2c0d5276aca016ea9478a7a6ed7481bbb209e9 100755 (executable)
@@ -160,6 +160,7 @@ if [ -z "$MACHINE_ID" ] && [ -f /etc/machine-info ]; then
 fi
 if [ -z "$MACHINE_ID" ] && [ -s /etc/machine-id ]; then
     read -r MACHINE_ID </etc/machine-id
+    [ "$MACHINE_ID" = "uninitialized" ] && unset MACHINE_ID
     [ -n "$MACHINE_ID" ] && \
         log_verbose "machine-id $MACHINE_ID acquired from /etc/machine-id"
 fi