From 5e289bc5956e6cb17da5add649325a4edb9fcd68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Fabian=20Silva=20Delgado?= Date: Wed, 12 Mar 2014 01:52:19 -0300 Subject: grub-1:2.02.beta2-2: fix 09_parabola to reduce issues with entries --- libre/grub/09_parabola | 49 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 16 deletions(-) (limited to 'libre/grub/09_parabola') diff --git a/libre/grub/09_parabola b/libre/grub/09_parabola index 49cbad4ba..90a9062a3 100644 --- a/libre/grub/09_parabola +++ b/libre/grub/09_parabola @@ -2,8 +2,9 @@ ## ## grub-mkconfig helper script specific to Parabola GNU/Linux-libre -## Contributed by "Keshav Padram Amburay" +## Contributed by "Keshav Amburay" ## Rebranded for Parabola by "André Silva" +## Updated on 08 February 2014 ## ## Script based on do_grub_config() function in Arch Archboot ISO Installer/Setup script ## Some parts taken from /etc/grub.d/10_linux script shipped by GRUB(2) upstream @@ -65,20 +66,29 @@ CLASS="--class parabola --class gnu-linux --class gnu --class os" [[ "${grub_file}" != "" ]] && _FUNC_GRUB_FILE_PRESENT BOOT_PART_FS_UUID="$(${grub_probe} --target="fs_uuid" "/boot" 2>/dev/null)" -BOOT_PART_HINTS_STRING="$(${grub_probe} --target="hints_string" "/boot" 2>/dev/null)" +BOOT_PART_HINTS_STRING="$(${grub_probe} --target="hints_string" "/boot" 2>/dev/null || true)" BOOT_PART_FS="$(${grub_probe} --target="fs" "/boot" 2>/dev/null)" -ROOT_PART_FS_UUID="$(${grub_probe} --target="fs_uuid" "/" 2>/dev/null)" -ROOT_PART_HINTS_STRING="$(${grub_probe} --target="hints_string" "/" 2>/dev/null)" -ROOT_PART_FS="$(${grub_probe} --target="fs" "/" 2>/dev/null)" - -if [[ "${ROOT_PART_FS_UUID}" == "${BOOT_PART_FS_UUID}" ]]; then - SUBDIR="/boot" -else - SUBDIR="" -fi +ROOT_PART_GRUB_DEVICE="$(${grub_probe} --target=device / || true)" +ROOT_PART_FS="$(${grub_probe} --device ${ROOT_PART_GRUB_DEVICE} --target=fs 2> /dev/null || echo "unknown")" if [[ "${GRUB_LINUX_ROOT_DEVICE}" == "" ]]; then + + case "${ROOT_PART_FS}" in + btrfs) + rootsubvol="$(make_system_path_relative_to_its_root /)" + rootsubvol="${rootsubvol#/}" + if [[ "${rootsubvol}" != "" ]]; then + GRUB_LINUX_ROOT_DEVICE="subvol=${rootsubvol}" + fi + ;; + zfs) + rpool="$(${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true)" + bootfs="$(make_system_path_relative_to_its_root / | sed -e "s,@$,,")" + GRUB_LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}" + ;; + esac + if [[ "${GRUB_DEVICE_UUID}" == "" ]] || \ [[ "${GRUB_DISABLE_LINUX_UUID}" == "true" ]] || \ [[ ! -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ]] || \ @@ -95,6 +105,10 @@ for _KERNEL_ in ${list} ; do echo "Found linux image: ${_KERNEL_}" >&2 + basename="$(basename "${_KERNEL_}")" + dirname="$(dirname "${_KERNEL_}")" + REAL_DIR="$(make_system_path_relative_to_its_root "${dirname}")" + _KERNEL_FILE_="$(echo ${_KERNEL_} | sed 's,/boot/,,g')" _KERNEL_PKG_="pkg-$(echo ${_KERNEL_FILE_} | sed 's,vmlinuz-,,g')" @@ -107,6 +121,7 @@ for _KERNEL_ in ${list} ; do cat << EOF menuentry "Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel" ${CLASS} { + $(save_default_entry) if [ x\$feature_all_video_module = xy ]; then insmod all_video fi @@ -118,9 +133,9 @@ menuentry "Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel" ${CLASS} { search --no-floppy --fs-uuid --set=root ${BOOT_PART_FS_UUID} fi echo 'Loading Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel ...' - linux ${SUBDIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw ${GRUB_LINUX_PARAMS} + linux ${REAL_DIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw ${GRUB_LINUX_PARAMS} echo 'Loading Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel initramfs ...' - initrd ${SUBDIR}/${_INITRAMFS_} + initrd ${REAL_DIR}/${_INITRAMFS_} } EOF @@ -135,6 +150,7 @@ EOF cat << EOF menuentry "Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel (fallback initramfs)" ${CLASS} { + $(save_default_entry) if [ x\$feature_all_video_module = xy ]; then insmod all_video fi @@ -146,9 +162,9 @@ menuentry "Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel (fallback initramfs)" search --no-floppy --fs-uuid --set=root ${BOOT_PART_FS_UUID} fi echo 'Loading Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel ...' - linux ${SUBDIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw ${GRUB_LINUX_PARAMS} + linux ${REAL_DIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw ${GRUB_LINUX_PARAMS} echo 'Loading Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel fallback initramfs ...' - initrd ${SUBDIR}/${_INITRAMFS_FALLBACK_} + initrd ${REAL_DIR}/${_INITRAMFS_FALLBACK_} } EOF @@ -158,6 +174,7 @@ EOF cat << EOF menuentry "Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel (no initramfs)" ${CLASS} { + $(save_default_entry) if [ x\$feature_all_video_module = xy ]; then insmod all_video fi @@ -169,7 +186,7 @@ menuentry "Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel (no initramfs)" ${CLA search --no-floppy --fs-uuid --set=root ${BOOT_PART_FS_UUID} fi echo 'Loading Parabola GNU/Linux-libre ${_KERNEL_PKG_} kernel ...' - linux ${SUBDIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw ${GRUB_LINUX_PARAMS} + linux ${REAL_DIR}/${_KERNEL_FILE_} root=${GRUB_LINUX_ROOT_DEVICE} rw ${GRUB_LINUX_PARAMS} } EOF -- cgit v1.2.2