]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Cope with / being on a ZFS root dataset
authorColin Watson <cjwatson@ubuntu.com>
Mon, 29 Oct 2018 12:33:37 +0000 (12:33 +0000)
committerDaniel Kiper <daniel.kiper@oracle.com>
Fri, 9 Nov 2018 12:36:52 +0000 (13:36 +0100)
If / is on the root dataset in a ZFS pool, then ${bootfs} will be set to
"/" (whereas if it is on a non-root dataset, there will be no trailing
slash).  Passing "root=ZFS=${rpool}/" will fail to boot, but
"root=ZFS=${rpool}" works fine, so strip the trailing slash.

Fixes: https://savannah.gnu.org/bugs/?52746
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
Tested-by: Fejes József <jozsef.fejes@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/grub.d/10_linux.in
util/grub.d/20_linux_xen.in

index 61ebd7dc714e87aedb167345729f574426d69b77..4532266be68301f9db4b262ee52d8ca77a962aec 100644 (file)
@@ -73,7 +73,7 @@ case x"$GRUB_FS" in
     xzfs)
        rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
        bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
-       LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
+       LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
        ;;
 esac
 
index e8143b079dc8bcdf21ec8a763b19a356c863a5e3..d22626e30df6aec86aa5b80859527b0baa320b12 100644 (file)
@@ -81,7 +81,7 @@ case x"$GRUB_FS" in
     xzfs)
        rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
        bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
-       LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
+       LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
        ;;
 esac