+2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Revert grub-file usage in grub-mkconfig.
+
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Make newly-created files other than grub.cfg world-readable.
name = '10_hurd';
common = util/grub.d/10_hurd.in;
installdir = grubconf;
+ condition = COND_HOST_HURD;
};
script = {
name = '10_kfreebsd';
common = util/grub.d/10_kfreebsd.in;
installdir = grubconf;
+ condition = COND_HOST_KFREEBSD;
};
script = {
name = '10_illumos';
common = util/grub.d/10_illumos.in;
installdir = grubconf;
+ condition = COND_HOST_ILLUMOS;
};
script = {
name = '10_netbsd';
common = util/grub.d/10_netbsd.in;
installdir = grubconf;
+ condition = COND_HOST_NETBSD;
};
script = {
name = '10_linux';
common = util/grub.d/10_linux.in;
installdir = grubconf;
+ condition = COND_HOST_LINUX;
};
script = {
name = '10_xnu';
common = util/grub.d/10_xnu.in;
installdir = grubconf;
+ condition = COND_HOST_XNU;
};
script = {
name = '20_linux_xen';
common = util/grub.d/20_linux_xen.in;
installdir = grubconf;
+ condition = COND_HOST_LINUX;
};
script = {
AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
+AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
+AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
+AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
+AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
+AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
+AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
gettext "Generate a grub config file"; echo
echo
print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
- print_option_help "-r, --root-directory=$(gettext DIR)" "$(gettext "use DIR as root directory [default=/]")"
print_option_help "-h, --help" "$(gettext "print this message and exit")"
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
echo
echo $1
}
-GRUB_ROOT=
-
# Check the arguments.
while test $# -gt 0
do
--output=*)
grub_cfg=`echo "$option" | sed 's/--output=//'`
;;
- -r | --root-directory)
- GRUB_ROOT=`argument $option "$@"`; shift;;
- --root-directory=*)
- GRUB_ROOT=`echo "$option" | sed 's/--output=//'`
- ;;
-*)
gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
usage
fi
# Device containing our userland. Typically used for root= parameter.
-GRUB_DEVICE="`${grub_probe} --target=device "$GRUB_ROOT"/`"
+GRUB_DEVICE="`${grub_probe} --target=device /`"
GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
# Device containing our /boot partition. Usually the same as GRUB_DEVICE.
-GRUB_DEVICE_BOOT="`${grub_probe} --target=device "$GRUB_ROOT"/boot`"
+GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
# Filesystem for the device containing our userland. Used for stuff like
# choosing Hurd filesystem module.
GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
-if [ x"$GRUB_FS" = x ] || [ x"$GRUB_FS" = xunknown ]; then
- GRUB_FS="$(stat -f --printf=%T "$GRUB_ROOT"/ || echo unknown)"
+if [ x"$GRUB_FS" = xunknown ]; then
+ GRUB_FS="$(stat -f --printf=%T / || echo unknown)"
fi
if test -f ${sysconfdir}/default/grub ; then
# These are defined in this script, export them here so that user can
# override them.
export GRUB_DEVICE \
- GRUB_ROOT \
GRUB_DEVICE_UUID \
GRUB_DEVICE_BOOT \
GRUB_DEVICE_BOOT_UUID \
for i in "${grub_mkconfig_dir}"/* ; do
case "$i" in
- "${grub_mkconfig_dir}"/00_header \
- | "${grub_mkconfig_dir}"/30_os-prober \
- | "${grub_mkconfig_dir}"/40_custom \
- | "${grub_mkconfig_dir}"/41_custom)
- if test -x "$i" ; then
- echo
- echo "### BEGIN $i ###"
- "$i"
- echo "### END $i ###"
- fi
- ;;
# emacsen backup files. FIXME: support other editors
*~) ;;
# emacsen autosave files. FIXME: support other editors
*/\#*\#) ;;
*)
if grub_file_is_not_garbage "$i" && test -x "$i" ; then
- for platform in x86 i386-xen-pae x86_64-xen mips mipsel sparc64 powerpc ia64 arm arm64; do
-
- GRUB_PLATFORM=$platform
- export GRUB_PLATFORM
- buf="$($i)"
- if [ x"$buf" != x ]; then
- echo
- echo "### BEGIN $i ($platform) ###"
- case x$platform in
- xx86)
- echo "if [ x\"\$grub_platform\" != xxen \\( x\"\$grub_cpu\" = xi386 -o x\"\$grub_cpu\" = xx86_64 -o x\"\$grub_platform\" = x \\) ]; then" ;;
- xi386-xen-pae)
- echo "if [ x\"\$grub_cpu-\$grub_platform\" = xi386-xen -o x\"\$grub_cpu-\$grub_platform\" = x- ]; then" ;;
- xx86_64-xen)
- echo "if [ x\"\$grub_cpu-\$grub_platform\" = xx86_64-xen -o x\"\$grub_cpu-\$grub_platform\" = x- ]; then" ;;
- *)
- echo "if [ x\"\$grub_cpu\" = x$platform -o x\"\$grub_platform\" = x ]; then" ;;
- esac
- echo "$buf"
- echo "fi"
- echo "### END $i ($platform) ###"
- fi
- done
+ echo
+ echo "### BEGIN $i ###"
+ "$i"
+ echo "### END $i ###"
fi
;;
esac
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
EOF
else
- for dir in "${pkgdatadir}" "`echo "$GRUB_ROOT"'/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`" "`echo "$GRUB_ROOT"'/usr/share/grub' | sed "s,//*,/,g"`" ; do
+ for dir in "${pkgdatadir}" "`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`" /usr/share/grub ; do
for basename in unicode unifont ascii; do
path="${dir}/${basename}.pf2"
if is_path_readable_by_grub "${path}" > /dev/null ; then
exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@"
-if [ x$GRUB_PLATFORM = xx86 ]; then
- check=--is-x86-multiboot
-elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
- check=--is-i386-xen-pae-domu
-elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
- check=--is-x86_64-xen-domu
-else
- exit 0
-fi
-
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
# FIXME: add l4 here?
kernel=
-for i in "$GRUB_ROOT"/boot/gnumach* ; do
- if test -f "$i" && "${grub_file}" $check "$i" ; then
- basename=`basename "$i"`
- dirname=`dirname "$i"`
- rel_dirname=`make_system_path_relative_to_its_root "$dirname"`
+for i in /boot/gnumach* ; do
+ if test -e $i ; then
+ basename=`basename $i`
+ dirname=`dirname $i`
+ rel_dirname=`make_system_path_relative_to_its_root $dirname`
gettext_printf "Found GNU Mach: %s" "$i" >&2
echo >&2
kernels="${kernels} ${rel_dirname}/${basename}"
*) hurd_fs="${GRUB_FS}fs" ;;
esac
-for i in "$GRUB_ROOT"/hurd/${hurd_fs}.static "$GRUB_ROOT"/hurd/exec ; do
- if test -f "$i" ; then
+for i in /hurd/${hurd_fs}.static /hurd/exec ; do
+ if test -e "$i" ; then
gettext_printf "Found Hurd module: %s" "$i" >&2
echo >&2
at_least_one=true
exit 0
fi
-if ${all_of_them} && test -f "$GRUB_ROOT"/lib/ld.so.1 ; then : ; else
+if ${all_of_them} && test -e /lib/ld.so.1 ; then : ; else
gettext "Some Hurd stuff found, but not enough to boot." >&2
echo >&2
exit 1
CLASS="--class os"
-if [ x$GRUB_PLATFORM = xx86 ]; then
- check=--is-x86-multiboot
-elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
- check=--is-i386-xen-pae-domu
-elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
- check=--is-x86_64-xen-domu
-else
- exit 0
-fi
-
-if ! test -f "$GRUB_ROOT"/platform/i86pc/kernel || ! "${grub_file}" $check "$GRUB_ROOT"/platform/i86pc/kernel; then
- exit 0
-fi
-
-
case "${GRUB_DISTRIBUTOR}" in
*)
OS="Illumos"
else
ISADIR=
fi
- zfs-bootfs $($grub_mkrelpath "$GRUB_ROOT"/) ZFS_BOOTFS
+ zfs-bootfs $($grub_mkrelpath /) ZFS_BOOTFS
echo '$(echo "$message" | grub_quote)'
multiboot $($grub_mkrelpath /platform/i86pc/kernel)/\$ISADIR/unix /platform/i86pc/kernel/\$ISADIR/unix -B \$ZFS_BOOTFS,console=text
module $($grub_mkrelpath /platform/i86pc)/\$ISADIR/boot_archive /platform/i86pc/\$ISADIR/boot_archive
CLASS="--class os"
-if [ x$GRUB_PLATFORM = xx86 ]; then
- check=--is-x86-kfreebsd
-elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
- check=--is-i386-xen-pae-domu
-elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
- check=--is-x86_64-xen-domu
-else
- exit 0
-fi
-
case "${GRUB_DISTRIBUTOR}" in
Debian)
OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD"
zfs)
load_kfreebsd_module opensolaris false
- ls "$GRUB_ROOT/boot/zfs/zpool.cache" > /dev/null
+ ls "/boot/zfs/zpool.cache" > /dev/null
printf '%s\n' "${prepare_boot_cache}"
sed "s/^/$submenu_indentation/" << EOF
- kfreebsd_module $(make_system_path_relative_to_its_root $GRUB_ROOT/boot)/zfs/zpool.cache type=/boot/zfs/zpool.cache
+ kfreebsd_module $(make_system_path_relative_to_its_root /boot)/zfs/zpool.cache type=/boot/zfs/zpool.cache
EOF
;;
esac
EOF
}
-list=`for i in $GRUB_ROOT/boot/kfreebsd-* $GRUB_ROOT/boot/kernel/kernel ; do
- if grub_file_is_not_garbage "$i" && ${grub_file} $check "$i"; then echo -n "$i " ; fi
+list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
boot_device_id=
dirname=`dirname $kfreebsd`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
- if [ -f "$GRUB_ROOT"/boot/device.hints ] ; then
- devices="$GRUB_ROOT"/boot/device.hints
+ if [ -f /boot/device.hints ] ; then
+ devices=/boot/device.hints
devices_basename=`basename $devices`
devices_dirname=`dirname $devices`
devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname`
# zpool name
kfreebsd_device=$(${grub_probe} -t fs_label --device ${GRUB_DEVICE})
# filesystem name (empty string for the main filesystem)
- kfreebsd_device="${kfreebsd_device}$(${grub_mkrelpath} "$GRUB_ROOT"/ | sed -e "s,/*@$,,")"
+ kfreebsd_device="${kfreebsd_device}$(${grub_mkrelpath} / | sed -e "s,/*@$,,")"
;;
*)
kfreebsd_device=${kfreebsd_fs}id/${GRUB_DEVICE_UUID}
# Debian GNU/kFreeBSD can't remount root if it's supplied as UUID but
# as an UUID
if [ "x${GRUB_DISTRIBUTOR}" = "xDebian" ] \
- && ! (cat "$GRUB_ROOT"/etc/fstab | awk '!/^[[:space:]]*#/ && $2=="/" { print $1; }' \
+ && ! (cat /etc/fstab | awk '!/^[[:space:]]*#/ && $2=="/" { print $1; }' \
| grep "${kfreebsd_fs}id/${GRUB_DEVICE_UUID}" > /dev/null); then
kfreebsd_device=${GRUB_DEVICE}
fi
alt_version=`echo $version | sed -e "s,\.old$,,g"`
module_dir=
- for i in "$GRUB_ROOT/lib/modules/${version}" "$GRUB_ROOT/lib/modules/${alt_version}" \
- "$GRUB_ROOT/boot/kernel"; do
+ for i in "/lib/modules/${version}" "/lib/modules/${alt_version}" \
+ "/boot/kernel"; do
if test -e "$i" ; then
module_dir="$i"
break
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
-if [ x$GRUB_PLATFORM = xx86 ]; then
- check=--is-x86-linux32
-elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
- check=--is-i386-xen-pae-domu
-elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
- check=--is-x86_64-xen-domu
-else
- check=--is-${GRUB_PLATFORM}-linux
-fi
-
-case "x$GRUB_PLATFORM" in
- xx86)
- list=`for i in "$GRUB_ROOT"/boot/vmlinuz-* "$GRUB_ROOT"/vmlinuz-* "$GRUB_ROOT"/boot/kernel-* ; do
- if grub_file_is_not_garbage "$i" && "${grub_file}" $check "$i" ; then echo -n "$i " ; fi
- done` ;;
- *)
- list=`for i in "$GRUB_ROOT"/boot/vmlinuz-* "$GRUB_ROOT"/boot/vmlinux-* "$GRUB_ROOT"/vmlinuz-* "$GRUB_ROOT"/vmlinux-* "$GRUB_ROOT"/boot/kernel-* ; do
- if grub_file_is_not_garbage "$i" && "${grub_file}" $check "$i" ; then echo -n "$i " ; fi
- done` ;;
-esac
-
-if [ x"$list" = x ]; then
- exit 0
-fi
-
CLASS="--class gnu-linux --class gnu --class os"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
case x"$GRUB_FS" in
xbtrfs)
- rootsubvol="`make_system_path_relative_to_its_root "$GRUB_ROOT"/`"
+ rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
- bootfs="`make_system_path_relative_to_its_root "$GRUB_ROOT"/ | sed -e "s,@$,,"`"
+ bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
;;
esac
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
- if [ x$dirname = x"$GRUB_ROOT"/ ]; then
+ if [ x$dirname = x/ ]; then
if [ -z "${prepare_root_cache}" ]; then
prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
fi
EOF
}
-case "$GRUB_PLATFORM" in
- x86 | i386-xen-pae | x86_64-xen) GENKERNEL_ARCH="x86" ;;
+machine=`uname -m`
+case "x$machine" in
+ xi?86 | xx86_64)
+ list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ done` ;;
+ *)
+ list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do
+ if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
+ done` ;;
+esac
+
+case "$machine" in
+ i?86) GENKERNEL_ARCH="x86" ;;
mips|mips64) GENKERNEL_ARCH="mips" ;;
mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
arm*) GENKERNEL_ARCH="arm" ;;
- *) GENKERNEL_ARCH="$GRUB_PLATFORM" ;;
+ *) GENKERNEL_ARCH="$machine" ;;
esac
prepare_boot_cache=
done
config=
- for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "$GRUB_ROOT/etc/kernels/kernel-config-${version}" ; do
+ for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
if test -e "${i}" ; then
config="${i}"
break
datarootdir="@datarootdir@"
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
-if [ x$GRUB_PLATFORM = xx86 ]; then
- check=--is-x86-kfreebsd
-elif [ x$GRUB_PLATFORM = xi386-xen-pae ]; then
- check=--is-i386-xen-pae-domu
-elif [ x$GRUB_PLATFORM = xx86_64-xen ]; then
- check=--is-x86_64-xen-domu
-else
- exit 0
-fi
-
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
loader="$1" # "knetbsd" or "multiboot"
kernel="$2" # absolute path to the kernel file
- if "${grub_file}" --is-x86_64-kfreebsd "${kernel}"; then
- karch="amd64"
- else
+ case $(zcat -f "${kernel}" | file -bL - | cut -d , -f 2 | tr -d ' ') in
+ Intel80386)
karch="i386"
- fi
+ ;;
+ x86-64)
+ karch="amd64"
+ ;;
+ *)
+ return
+ ;;
+ esac
- case $GRUB_FS in
+ case $(${grub_probe} --target=fs -d ${GRUB_DEVICE}) in
ext2)
kmod="ext2fs"
;;
esac
kversion=$(zcat -f "${kernel}" | strings | sed -n -e '/^@(#)NetBSD/ { s/^@(#)NetBSD \([0-9\.]*\) .*$/\1/g ; p ; q ; }')
- kmodule="$GRUB_ROOT/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod"
+ kmodule="/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod"
if test -z "$karch" -o -z "$kversion" -o ! -f "${kmodule}"; then
return
type="$3"
args="$4" # extra arguments appended to loader command
- if [ "x${loader}" = xmultiboot ] && [ x$GRUB_PLATFORM = xx86 ] && ! "$grub_file" --is-x86-multiboot "$kernel"; then
- return
- fi
-
kroot_device="$(echo ${GRUB_DEVICE} | sed -e 's,^/dev/r,,')"
if [ -z "$boot_device_id" ]; then
submenu_indentation=""
is_top_level=true
-for k in "$GRUB_ROOT"/netbsd $(ls -t "$GRUB_ROOT"/netbsd?* 2>/dev/null) ; do
+for k in /netbsd $(ls -t /netbsd?* 2>/dev/null) ; do
if ! grub_file_is_not_garbage "$k" ; then
continue
fi
- if ! "$grub_file" $check "$k"; then
- continue
- fi
if ! (zcat -f "$k" | file -bL - | grep -q "${pattern}") 2>/dev/null ; then
continue
fi
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
-if [ x$GRUB_PLATFORM != xx86 ]; then
- exit 0
-fi
-
osx_entry() {
if [ x$2 = x32 ]; then
# TRANSLATORS: it refers to kernel architecture (32-bit)
bitstr="$(gettext "(32-bit)")"
- if ! [ -f "$GRUB_ROOT"/mach_kernel ] || ! "${grub_file}" --is-i386-xnu "$GRUB_ROOT"/mach_kernel; then
- return;
- fi
else
# TRANSLATORS: it refers to kernel architecture (64-bit)
bitstr="$(gettext "(64-bit)")"
- if ! [ -f "$GRUB_ROOT"/mach_kernel ] || ! "${grub_file}" --is-x86_64-xnu "$GRUB_ROOT"/mach_kernel; then
- return;
- fi
fi
# TRANSLATORS: it refers on the OS residing on device %s
onstr="$(gettext_printf "(on %s)" "${GRUB_DEVICE}")"
cat << EOF
-menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'xnu-$2-$(grub_get_device_id "${GRUB_DEVICE}")' {
+menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${GRUB_DEVICE}")' {
EOF
save_default_entry | grub_add_tab
prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab
fi
fi
if [ \$do_resume = 0 ]; then
- xnu_uuid ${GRUB_DEVICE_UUID} uuid
+ xnu_uuid ${OSXUUID} uuid
if [ -f /Extra/DSDT.aml ]; then
acpi -e /Extra/DSDT.aml
fi
EOF
}
+OSXUUID="`${grub_probe} --target=fs_uuid --device ${GRUB_DEVICE} 2> /dev/null`"
osx_entry xnu_kernel 32
osx_entry xnu_kernel64 64
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
-if [ x$GRUB_PLATFORM != xx86 ]; then
- exit 0
-fi
-
CLASS="--class gnu-linux --class gnu --class os --class xen"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
case x"$GRUB_FS" in
xbtrfs)
- rootsubvol="`make_system_path_relative_to_its_root "$GRUB_ROOT"/`"
+ rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
- bootfs="`make_system_path_relative_to_its_root "$GRUB_ROOT"/ | sed -e "s,@$,,"`"
+ bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs}"
;;
esac
EOF
}
-linux_list=`for i in "$GRUB_ROOT"/boot/vmlinu[xz]-* "$GRUB_ROOT"/vmlinu[xz]-* "$GRUB_ROOT"/boot/kernel-*; do
- if grub_file_is_not_garbage "$i" && "${grub_file}" --is-x86-xen-dom0 "$i"; then
- echo -n "$i " ;
+linux_list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
+ if grub_file_is_not_garbage "$i"; then
+ basename=$(basename $i)
+ version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
+ dirname=$(dirname $i)
+ config=
+ for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
+ if test -e "${j}" ; then
+ config="${j}"
+ break
+ fi
+ done
+ if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then echo -n "$i " ; fi
fi
done`
if [ "x${linux_list}" = "x" ] ; then
esac
}
-xen_list=`for i in "$GRUB_ROOT"/boot/xen*; do
- if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" && ${grub_file} --is-x86-multiboot "$i"; then echo -n "$i " ; fi
+xen_list=`for i in /boot/xen*; do
+ if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
boot_device_id=