2015-05-11 13:16:27 +02:00
insmod part_msdos
insmod part_gpt
insmod search
insmod configfile
insmod legacy_configfile
2017-05-12 09:10:19 +02:00
insmod lvm
2018-03-12 05:46:39 +01:00
insmod mdraid09
insmod mdraid1x
2015-05-11 13:16:27 +02:00
set debian_cddev = ""
set debian_cdarch = ""
if [ "${grub_cpu}" = "x86_64" ]; then
debian_cdarch = "amd"
fi
if [ "${grub_cpu}" = "i386" ]; then
debian_cdarch = "i386"
fi
if [ -n "${debian_cdarch}" ]; then
set debian_kern = "/install.${debian_cdarch}/xen/vmlinuz"
set debian_initrd = "/install.${debian_cdarch}/xen/initrd.gz"
search -s debian_domUcfg -f "/install.${debian_cdarch}/xen/debian.cfg"
search -s debian_cdkern -f "${debian_kern}"
search -s debian_cdinitrd -f "${debian_initrd}"
if [ -n "${debian_domUcfg}" -a -n "${debian_cdinitrd}" -a -n "${debian_cdkern}" -a "${debian_domUcfg}" = "${debian_cdinitrd}" -a "${debian_domUcfg}" = "${debian_cdkern}" ]; then
debian_cddev = "${debian_domUcfg}"
fi
fi
set fedora_cddev = ""
if [ "${grub_cpu}" = "x86_64" ]; then
set fedora_kern = "/images/pxeboot/vmlinuz"
set fedora_initrd = "/images/pxeboot/initrd.img"
search -s fedora_cdkern -f "${fedora_kern}"
search -s fedora_cdinitrd -f "${fedora_initrd}"
if [ -n "${fedora_cdkern}" -a -n "${fedora_cdinitrd}" -a "${fedora_cdkern}" = "${fedora_cdinitrd}" ]; then
set fedora_cddev = "${fedora_cdkern}"
fi
fi
set suse_cddev = ""
2017-09-21 03:25:53 +02:00
if [ "${grub_cpu}" = "i386" ]; then
set suse_cdarch = "i586"
else
set suse_cdarch = "${grub_cpu}"
fi
if [ -n "${suse_cdarch}" ]; then
set suse_kern = "/boot/${suse_cdarch}/loader/linux"
set suse_initrd = "/boot/${suse_cdarch}/loader/initrd"
search -s suse_cdkern -f "${suse_kern}"
search -s suse_cdinitrd -f "${suse_initrd}"
if [ -n "${suse_cdkern}" -a -n "${suse_cdinitrd}" -a "${suse_cdkern}" = "${suse_cdinitrd}" ]; then
set suse_cddev = "${suse_cdkern}"
fi
2015-05-11 13:16:27 +02:00
fi
2015-12-19 09:41:39 +01:00
set hdcfg_list = "\
/boot/grub2/grub.cfg \
/grub2/grub.cfg\
"
2015-12-08 08:55:20 +01:00
2015-12-19 09:41:39 +01:00
set hdlst_list = "\
/boot/grub/menu.lst \
/grub/menu.lst\
"
2015-05-11 13:16:27 +02:00
2015-12-08 08:55:20 +01:00
for c in ${hdcfg_list}; do
2017-05-12 09:10:19 +02:00
btrfs_relative_path = 1
2015-05-11 13:16:27 +02:00
if search -s hddev -f "${c}"; then
2017-05-12 09:10:19 +02:00
btrfs_relative_path = 0
2015-12-19 09:41:39 +01:00
menuentry "${hddev} Boot From Hard Disk (${c})" "${hddev}" "${c}" {
set root = "${2}"
set cfg = "${3}"
2017-05-12 09:10:19 +02:00
btrfs-get-default-subvol -p -o btrfs_default_subvol ($root)
if [ -n "${btrfs_default_subvol}" ]; then
configfile "${btrfs_default_subvol}${cfg}"
else
configfile "${cfg}"
fi
2015-12-08 08:55:20 +01:00
}
2015-05-11 13:16:27 +02:00
break
2015-12-08 08:55:20 +01:00
fi
2017-05-12 09:10:19 +02:00
btrfs_relative_path = 0
2015-12-08 08:55:20 +01:00
done
for c in ${hdlst_list}; do
2017-05-12 09:10:19 +02:00
btrfs_relative_path = 1
2015-12-08 08:55:20 +01:00
if search -s hddev -f "${c}"; then
2017-05-12 09:10:19 +02:00
btrfs_relative_path = 0
2015-12-19 09:41:39 +01:00
menuentry "${hddev} Boot From Hard Disk (${c})" "${hddev}" "${c}" {
set root = "${2}"
set cfg = "${3}"
2017-05-12 09:10:19 +02:00
btrfs-get-default-subvol -p -o btrfs_default_subvol ($root)
if [ -n "${btrfs_default_subvol}" ]; then
legacy_configfile "${btrfs_default_subvol}${cfg}"
else
legacy_configfile "${cfg}"
fi
2015-12-08 08:55:20 +01:00
}
break
fi
2017-05-12 09:10:19 +02:00
btrfs_relative_path = 0
2015-05-11 13:16:27 +02:00
done
set timeout = 0
if [ -n "${debian_cddev}" ]; then
set timeout = 8
menuentry "${debian_cddev} Debian Install" {
set root = "${debian_cddev}"
linux "${debian_kern}" ignore_loglevel
initrd "${debian_initrd}"
}
fi
if [ -n "${fedora_cddev}" ]; then
set timeout = 8
menuentry "${fedora_cddev} Fedora Install" {
set root = "${fedora_cddev}"
linux "${fedora_kern}" ignore_loglevel
initrd "${fedora_initrd}"
}
menuentry "${fedora_cddev} Fedora Rescue" {
set root = "${fedora_cddev}"
linux "${fedora_kern}" ignore_loglevel rescue
initrd "${fedora_initrd}"
}
fi
if [ -n "${suse_cddev}" ]; then
set timeout = 8
set root = "${suse_cddev}"
set suse_cdcfg = "/boot/${suse_cdarch}/grub2-xen/grub.cfg"
2017-09-20 06:29:01 +02:00
if [ -e "/boot/${suse_cdarch}/vmlinuz-xen" ]; then
2017-09-21 03:25:53 +02:00
set suse_kern = "/boot/${suse_cdarch}/vmlinuz-xen"
set suse_initrd = "/boot/${suse_cdarch}/initrd-xen"
2017-09-20 06:29:01 +02:00
fi
2015-05-11 13:16:27 +02:00
if [ -f "${suse_cdcfg}" ]; then
menuentry "${suse_cddev} SUSE Install menu" {
set root = "${suse_cddev}"
configfile "${suse_cdcfg}"
}
2017-09-21 03:25:53 +02:00
elif [ -f "${suse_kern}" -a -f "$suse_initrd" ]; then
2015-05-11 13:16:27 +02:00
menuentry "${suse_cddev} SUSE Install" {
2017-11-09 07:47:16 +01:00
linux "${suse_kern}" xencons = hvc0
2017-09-21 03:25:53 +02:00
initrd "${suse_initrd}"
2015-05-11 13:16:27 +02:00
}
menuentry "${suse_cddev} SUSE Rescue" {
2017-11-09 07:47:16 +01:00
linux "${suse_kern}" xencons = hvc0 rescue=1
2017-09-21 03:25:53 +02:00
initrd "${suse_initrd}"
2015-05-11 13:16:27 +02:00
}
menuentry "${suse_cddev} SUSE Upgrade" {
2017-11-09 07:47:16 +01:00
linux "${suse_kern}" xencons = hvc0 upgrade=1
2017-09-21 03:25:53 +02:00
initrd "${suse_initrd}"
2015-05-11 13:16:27 +02:00
}
else
echo "the device ${suse_cddev} is not xen pv bootable"
fi
fi