summaryrefslogtreecommitdiff
path: root/src/kernel-install/90-loaderentry.install
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2017-05-30 22:45:10 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-05-30 09:45:10 -0400
commit9d8813b3b4f69d9428e7759ed8a2956d8846b0fb (patch)
treea38871ace65629726380791f07237f842e80858e /src/kernel-install/90-loaderentry.install
parente74d0a9a5cdd8562aeaab1994ebd9c4cd07e82c3 (diff)
downloadsystemd-9d8813b3b4f69d9428e7759ed8a2956d8846b0fb.tar.gz
kernel-install: support the case /etc/machine-id is missing or empty (#5975)
Some .install plugins does not require that machine ID is set such as 20-grubby.install for Fedora and 50-depmod.install. To support such plugins to run without valid machine-id, this commit makes the following change: * if /etc/machine-id is missing or empty, create temporary directory and set its path to BOOT_DIR_ABS, * run the .install helpers with KERNEL_INSTALL_MACHINE_ID environment variable that'd be empty if /etc/machine-id is missing or empty. This may be useful for installing kernel for e.g. stateless systems which initialize machine-id while booting the systems.
Diffstat (limited to 'src/kernel-install/90-loaderentry.install')
-rw-r--r--src/kernel-install/90-loaderentry.install8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
index a0bca05c9a..305ea8f5c9 100644
--- a/src/kernel-install/90-loaderentry.install
+++ b/src/kernel-install/90-loaderentry.install
@@ -7,13 +7,11 @@ KERNEL_VERSION="$2"
BOOT_DIR_ABS="$3"
KERNEL_IMAGE="$4"
-if [[ -f /etc/machine-id ]]; then
- read MACHINE_ID < /etc/machine-id
+if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then
+ exit 0
fi
-if ! [[ $MACHINE_ID ]]; then
- exit 1
-fi
+MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
BOOT_DIR="/$MACHINE_ID/$KERNEL_VERSION"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}