Cope with / being on a ZFS root dataset

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>
This commit is contained in:
Colin Watson 2018-10-29 12:33:37 +00:00 committed by Daniel Kiper
parent b71ac53751
commit e720eef6a6
2 changed files with 2 additions and 2 deletions

View file

@ -73,7 +73,7 @@ case x"$GRUB_FS" in
xzfs) xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}" LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
;; ;;
esac esac

View file

@ -81,7 +81,7 @@ case x"$GRUB_FS" in
xzfs) xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true` rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}" LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
;; ;;
esac esac