1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-05 09:17:44 +03:00

Handle MACHINE_ID=uninitialized

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

(cherry picked from commit 305dd91adf)
(cherry picked from commit 132f0ec7de)

Backported for https://bugzilla.redhat.com/show_bug.cgi?id=2148464.
This commit is contained in:
Marcus Schäfer 2022-11-16 16:25:08 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent 7f18d82308
commit fa71bb7bce

View File

@ -140,6 +140,7 @@ if [ -z "$MACHINE_ID" ] && [ -r /etc/machine-info ] && . /etc/machine-info && MA
echo "machine-id $MACHINE_ID acquired from /etc/machine-info"
fi
if [ -z "$MACHINE_ID" ] && [ -s /etc/machine-id ] && read -r MACHINE_ID </etc/machine-id; then
[ "$MACHINE_ID" = "uninitialized" ] && unset MACHINE_ID
[ -n "$MACHINE_ID" ] && [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
echo "machine-id $MACHINE_ID acquired from /etc/machine-id"
fi