1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00

kernel-install: bail if machine id generation fails

The call is unlikely to fail, but systemd-id128 might not be installed.
We shouldn't continue with the empty string.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-05-19 14:43:03 +02:00
parent 94cbddf439
commit b21ba8ac6b

View File

@ -114,7 +114,9 @@ fi
# compatibility).
[ -z "$MACHINE_ID" ] && [ -r /etc/machine-info ] && . /etc/machine-info && MACHINE_ID="$KERNEL_INSTALL_MACHINE_ID"
[ -z "$MACHINE_ID" ] && [ -r /etc/machine-id ] && read -r MACHINE_ID </etc/machine-id
[ -z "$MACHINE_ID" ] && MACHINE_ID="$(systemd-id128 new)"
if [ -z "$MACHINE_ID" ]; then
MACHINE_ID="$(systemd-id128 new)" || exit 1
fi
# Now that we determined the machine ID to use, let's determine the "token" for
# the boot loader entry to generate. We use that for naming the directory below