]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
kernel-install: bail if machine id generation fails
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 19 May 2022 12:43:03 +0000 (14:43 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 19 May 2022 13:38:25 +0000 (15:38 +0200)
The call is unlikely to fail, but systemd-id128 might not be installed.
We shouldn't continue with the empty string.

src/kernel-install/kernel-install.in

index 0428c88fb3cf5caf999e5adc4b42ff05ae35f6f6..48072e346b16f2aa74bcce065dc978d9bcf96143 100755 (executable)
@@ -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