summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKir Kolyshkin <kolyshkin@gmail.com>2020-07-31 19:24:15 -0700
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-09-20 12:51:37 +0200
commit936a33812c50ed9464c4df72c4aa116ca7576b48 (patch)
tree99a8370fc2d250f0c7ad7927e7859dc2eeff75bf
parent6eecf085625938c8db9016c62d83f81a7df84555 (diff)
downloadsystemd-936a33812c50ed9464c4df72c4aa116ca7576b48.tar.gz
kernel-install/90-loaderentry: fix when /boot is not mountpointv243.9
I happen to have a machine where /boot is not a separate mountpoint, but rather just a directory under /. After upgrade to recent Fedora, I found out that grub2 can't find any new kernels. This happens because loadentry script generates kernel and initrd file paths relative to /boot, while grub2 expects path to be relative to the root of filesystem on which they are residing. This commit fixes this issue by using stat's %m to find the mount point of a partition holding the images, and using it as a prefix to be removed from ENTRY_DIR_ABS. Note that %m for stat requires coreutils 8.6, released in Oct 2010. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 1cdbff1c844ce46f1d84d8feeed426ebfd550988) (cherry picked from commit 2ee1c57c4ff4fd3349cf03c2e89fbd18ca0b3a4a) (cherry picked from commit 325edff51a8f03c8c777a6c2762e7891266cc9dc) (cherry picked from commit 3ceaa81c61b654ebf562464d142675bd4d57d7b6)
-rw-r--r--src/kernel-install/90-loaderentry.install5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/kernel-install/90-loaderentry.install b/src/kernel-install/90-loaderentry.install
index 133378da6b..f2dd958183 100644
--- a/src/kernel-install/90-loaderentry.install
+++ b/src/kernel-install/90-loaderentry.install
@@ -18,8 +18,9 @@ fi
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
-ENTRY_DIR="/$MACHINE_ID/$KERNEL_VERSION"
-BOOT_ROOT=${ENTRY_DIR_ABS%$ENTRY_DIR}
+BOOT_ROOT=${ENTRY_DIR_ABS%/$MACHINE_ID/$KERNEL_VERSION}
+BOOT_MNT=$(stat -c %m $BOOT_ROOT)
+ENTRY_DIR=/${ENTRY_DIR_ABS#$BOOT_MNT}
if [[ $COMMAND == remove ]]; then
rm -f "$BOOT_ROOT/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"