exec_prefix="/usr"
datarootdir="/usr/share"
-. "/usr/share/grub/grub-mkconfig_lib"
+. "$pkgdatadir/grub-mkconfig_lib"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
;;
esac
+# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
+# and mounting btrfs requires user space scanning, so force UUID in this case.
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
- || uses_abstraction "${GRUB_DEVICE}" lvm; then
+ || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
exec_prefix="/usr"
datarootdir="/usr/share"
-. "/usr/share/grub/grub-mkconfig_lib"
+. "$pkgdatadir/grub-mkconfig_lib"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
;;
esac
+# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
+# and mounting btrfs requires user space scanning, so force UUID in this case.
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
- || uses_abstraction "${GRUB_DEVICE}" lvm; then
+ || test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
-. "/usr/share/grub/grub-mkconfig_lib"
+. "$pkgdatadir/grub-mkconfig_lib"
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
exit 0
fi
-if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
+if [ -z "`which os-prober 2> /dev/null`" ] || [ -z "`which linux-boot-prober 2> /dev/null`" ] ; then
# missing os-prober and/or linux-boot-prober
exit 0
fi
fi
if [ /kernelcache -nt /System/Library/Extensions ]; then
$1 /kernelcache boot-uuid=\${uuid} rd=*uuid
+ elif [ -f /System/Library/Kernels/kernel ]; then
+ $1 /System/Library/Kernels/kernel boot-uuid=\${uuid} rd=*uuid
+ xnu_kextdir /System/Library/Extensions
else
$1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
BOOT="`echo ${OS} | cut -d ':' -f 4`"
- UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"
- EXPUUID="$UUID"
+ if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then
+ EXPUUID="$UUID"
- if [ x"${DEVICE#*@}" != x ] ; then
+ if [ x"${DEVICE#*@}" != x ] ; then
EXPUUID="${EXPUUID}@${DEVICE#*@}"
- fi
+ fi
- if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" -a "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
- echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
- continue
+ if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
+ echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
+ continue
+ fi
fi
BTRFS="`echo ${OS} | cut -d ':' -f 5`"
LONGNAME="${LABEL}"
fi
+ # os-prober returns text string followed by optional counter
+ CLASS="--class $(echo "${LABEL}" | LC_ALL=C sed 's,[[:digit:]]*$,,' | cut -d' ' -f1 | tr 'A-Z' 'a-z' | LC_ALL=C sed 's,[^[:alnum:]_],_,g')"
+
gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2
case ${BOOT} in
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
cat << EOF
-menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
+menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-chain-$(grub_get_device_id "${DEVICE}")' {
EOF
save_default_entry | grub_add_tab
prepare_grub_to_access_device ${DEVICE} | grub_add_tab
DEVICE=${DEVICE%@*}
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
cat << EOF
-menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class windows --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
+menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' $CLASS --class os \$menuentry_id_option 'osprober-efi-$(grub_get_device_id "${DEVICE}")' {
EOF
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
cat << EOF
-menuentry '$(echo "$OS $onstr" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
+menuentry '$(echo "$OS $onstr" | grub_quote)' $CLASS --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-simple-$boot_device_id' {
EOF
save_default_entry | grub_add_tab
printf '%s\n' "${prepare_boot_cache}"
echo "$title_correction_code"
;;
macosx)
- OSXUUID="${UUID}"
- osx_entry xnu_kernel 32
- osx_entry xnu_kernel64 64
+ if [ "${UUID}" ]; then
+ OSXUUID="${UUID}"
+ osx_entry xnu_kernel 32
+ osx_entry xnu_kernel64 64
+ fi
;;
hurd)
onstr="$(gettext_printf "(on %s)" "${DEVICE}")"