From 29cae9f5fafb6f6981f1ff02993af0423d862bfe Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Tue, 1 Dec 2015 22:05:11 +0100 Subject: Add working UEFI support to the Live ISO. --- EFI/BOOT/grub-embedded.cfg | 2 + EFI/BOOT/grub.cfg | 91 +++++++++++ EFI/BOOT/make-grub.sh | 55 +++++++ EFI/BOOT/osdetect.cfg | 390 +++++++++++++++++++++++++++++++++++++++++++++ EFI/BOOT/tools.cfg | 43 +++++ 5 files changed, 581 insertions(+) create mode 100644 EFI/BOOT/grub-embedded.cfg create mode 100644 EFI/BOOT/grub.cfg create mode 100644 EFI/BOOT/make-grub.sh create mode 100644 EFI/BOOT/osdetect.cfg create mode 100644 EFI/BOOT/tools.cfg (limited to 'EFI') diff --git a/EFI/BOOT/grub-embedded.cfg b/EFI/BOOT/grub-embedded.cfg new file mode 100644 index 0000000..b9008a8 --- /dev/null +++ b/EFI/BOOT/grub-embedded.cfg @@ -0,0 +1,2 @@ +search --file --set=root /boot/generic +set prefix=($root)/EFI/BOOT/ diff --git a/EFI/BOOT/grub.cfg b/EFI/BOOT/grub.cfg new file mode 100644 index 0000000..43dbe72 --- /dev/null +++ b/EFI/BOOT/grub.cfg @@ -0,0 +1,91 @@ +set default="0" +set timeout="30" +set hidden_timeout_quiet=false + +menuentry "Detect/isolinux any installed operating system" { + configfile "/EFI/BOOT/osdetect.cfg" +} + +menuentry "Slackware64 14.2 live in English (USA)" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=us tz=US/Pacific locale=en_US.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Dutch" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=nl tz=Europe/Amsterdam locale=nl_NL.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in French" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=fr tz=Europe/Paris locale=fr_FR.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in German" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=de tz=Europe/Berlin locale=de_DE.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Greek" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=us tz=Europe/Athens locale=el_GR.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Norwegian" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=no-latin1 tz=Europe/Oslo locale=nb_NO.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Polish" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=pl tz=Europe/Warsaw locale=pl_PL.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Portuguese (Brazil)" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=br-abnt2 tz=America/Sao_Paulo locale=pt_BR.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Portuguese (Portugal)" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=pt-latin1 tz=Europe/Lisbon locale=pt_PT.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Russian" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=ruwin_cplk-UTF-8 tz=Europe/Moscow locale=ru_RU.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Spanish (Latin America)" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=la-latin1 tz=America/Costa_Rica locale=es_CR.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Swedish" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=sv-latin1 tz=Europe/Stockholm locale=sv_SE.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Turkish" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=trq tz=Europe/Istanbul locale=tr_TR.utf8 + initrd /boot/initrd.img +} + +menuentry "Slackware64 14.2 live in Ukrainian" { + echo "Loading kernel and initrd. Please wait..." + linux /boot/generic load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=ua tz=Europe/Kiev locale=uk_UA.utf8 + initrd /boot/initrd.img +} diff --git a/EFI/BOOT/make-grub.sh b/EFI/BOOT/make-grub.sh new file mode 100644 index 0000000..d5fcd65 --- /dev/null +++ b/EFI/BOOT/make-grub.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +# Copyright 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# 30-nov-2015: Modified by Eric Hameleers for Slackware Live Edition. + +# Create the 64-bit EFI GRUB binary (bootx64.efi) and the El-Torito boot +# image (efiboot.img) that goes in the /isolinux directory for booting on +# UEFI systems. + +echo +echo "Building /EFI/BOOT/bootx64.efi and /boot/syslinux/efiboot.img." + +# First, build bootx64.efi, which will be installed here in /EFI/BOOT: +grub-mkimage --format=x86_64-efi --output=bootx64.efi --config=grub-embedded.cfg --compression=xz --prefix=/EFI/BOOT part_gpt part_msdos fat ext2 hfs hfsplus iso9660 udf ufs1 ufs2 zfs chain linux boot appleldr ahci configfile normal regexp minicmd reboot halt search search_fs_file search_fs_uuid search_label gfxterm gfxmenu efi_gop efi_uga all_video loadbios gzio echo true probe loadenv bitmap_scale font cat help ls png jpeg tga test at_keyboard usb_keyboard + +# Then, create a FAT formatted image that contains bootx64.efi in the +# /EFI/BOOT directory. This is used to bootstrap GRUB from the ISO image. +dd if=/dev/zero of=efiboot.img bs=1K count=1440 +# Format the image as FAT12: +mkdosfs -F 12 efiboot.img +# Create a temporary mount point: +MOUNTPOINT=$(mktemp -d) +# Mount the image there: +mount -o loop efiboot.img $MOUNTPOINT +# Copy the GRUB binary to /EFI/BOOT: +mkdir -p $MOUNTPOINT/EFI/BOOT +cp -a bootx64.efi $MOUNTPOINT/EFI/BOOT +# Unmount and clean up: +umount $MOUNTPOINT +rmdir $MOUNTPOINT +# Move the efiboot.img to ../../boot/syslinux: +mv efiboot.img ../../boot/syslinux/ + +echo +echo "Done building /EFI/BOOT/bootx64.efi and /boot/syslinux/efiboot.img." + diff --git a/EFI/BOOT/osdetect.cfg b/EFI/BOOT/osdetect.cfg new file mode 100644 index 0000000..40bfd28 --- /dev/null +++ b/EFI/BOOT/osdetect.cfg @@ -0,0 +1,390 @@ +# Sample GRUB script to autodetect operating systems +# +# Copyright (C) 2010 Free Software Foundation, Inc. +# Copyright (C) 2011, 2012 Jordan Uggla +# Copyright (C) 2011, 2012 Adrian Gibanel +# Copyright (C) 2013 Niall Walsh +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +source "${prefix}/tools.cfg" + +set saved_root=$root + +function freebsd_ufs_variants { + set device=$1 + set fstype=$2 + set uuid=$3 + + menuentry "FreeBSD ($fstype $device)" $device $uuid { + set root=$2 + set uuid=$3 + + kfreebsd /boot/kernel/kernel + set kFreeBSD.acpi_load=YES + set kFreeBSD.hint.acpi.0.disabled=0 + set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid + kfreebsd_loadenv /boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (single)" $device $uuid { + set root=$2 + set uuid=$3 + + kfreebsd /boot/kernel/kernel -s + set kFreeBSD.acpi_load=YES + set kFreeBSD.hint.acpi.0.disabled=0 + set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid + kfreebsd_loadenv /boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (verbose)" $device $uuid { + set root=$2 + set uuid=$3 + + kfreebsd /boot/kernel/kernel -v + set kFreeBSD.acpi_load=YES + set kFreeBSD.hint.acpi.0.disabled=0 + set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid + kfreebsd_loadenv /boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (no ACPI)" $device $uuid { + set root=$2 + set uuid=$3 + + kfreebsd /boot/kernel/kernel -v + unset kFreeBSD.acpi_load + set kFreeBSD.hint.acpi.0.disabled=1 + set kFreeBSD.loader.acpi_disabled_by_user=1 + set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid + kfreebsd_loadenv /boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (safe mode)" $device $uuid { + set root=$2 + set uuid=$3 + + kfreebsd /boot/kernel/kernel -v + unset kFreeBSD.acpi_load + set kFreeBSD.hint.acpi.0.disabled=1 + set kFreeBSD.loader.acpi_disabled_by_user=1 + set kFreeBSD.hint.apic.0.disabled=1 + set kFreeBSD.hw.ata.ata_dma=0 + set kFreeBSD.hw.ata.atapi_dma=0 + set kFreeBSD.hw.ata.wc=0 + set kFreeBSD.hw.eisa_slots=0 + set kFreeBSD.hint.kbdmux.0.disabled=1 + set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/$uuid + kfreebsd_loadenv /boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (Default boot loader)" $device $uuid { + set root=$2 + + kfreebsd /boot/loader + } +} + +function freebsd_zfs_variants { + set device=$1 + set fstype=zfs + + menuentry "FreeBSD ($fstype $device)" $device { + set root=$2 + + kfreebsd /@/boot/kernel/kernel + set kFreeBSD.acpi_load=YES + set kFreeBSD.hint.acpi.0.disabled=0 + kfreebsd_module_elf /@/boot/kernel/opensolaris.ko + kfreebsd_module_elf /@/boot/kernel/zfs.ko + kfreebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache + probe -l -s name $root + set kFreeBSD.vfs.root.mountfrom=zfs:$name + kfreebsd_loadenv /@/boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (single)" $device { + set root=$2 + + kfreebsd /@/boot/kernel/kernel -s + set kFreeBSD.acpi_load=YES + set kFreeBSD.hint.acpi.0.disabled=0 + kfreebsd_module_elf /@/boot/kernel/opensolaris.ko + kfreebsd_module_elf /@/boot/kernel/zfs.ko + kfreebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache + probe -l -s name $root + set kFreeBSD.vfs.root.mountfrom=zfs:$name + kfreebsd_loadenv /@/boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (verbose)" $device { + set root=$2 + + kfreebsd /@/boot/kernel/kernel -v + set kFreeBSD.acpi_load=YES + set kFreeBSD.hint.acpi.0.disabled=0 + kfreebsd_module_elf /@/boot/kernel/opensolaris.ko + kfreebsd_module_elf /@/boot/kernel/zfs.ko + kfreebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache + probe -l -s name $root + set kFreeBSD.vfs.root.mountfrom=zfs:$name + kfreebsd_loadenv /@/boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (no ACPI)" $device { + set root=$2 + + kfreebsd /@/boot/kernel/kernel -v + unset kFreeBSD.acpi_load + set kFreeBSD.hint.acpi.0.disabled=1 + set kFreeBSD.loader.acpi_disabled_by_user=1 + kfreebsd_module_elf /@/boot/kernel/opensolaris.ko + kfreebsd_module_elf /@/boot/kernel/zfs.ko + kfreebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache + probe -l -s name $root + set kFreeBSD.vfs.root.mountfrom=zfs:$name + kfreebsd_loadenv /@/boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (safe mode)" $device { + set root=$2 + + kfreebsd /@/boot/kernel/kernel -v + unset kFreeBSD.acpi_load + set kFreeBSD.hint.acpi.0.disabled=1 + set kFreeBSD.loader.acpi_disabled_by_user=1 + set kFreeBSD.hint.apic.0.disabled=1 + set kFreeBSD.hw.ata.ata_dma=0 + set kFreeBSD.hw.ata.atapi_dma=0 + set kFreeBSD.hw.ata.wc=0 + set kFreeBSD.hw.eisa_slots=0 + set kFreeBSD.hint.kbdmux.0.disabled=1 + kfreebsd_module_elf /@/boot/kernel/opensolaris.ko + kfreebsd_module_elf /@/boot/kernel/zfs.ko + kfreebsd_module /@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache + probe -l -s name $root + set kFreeBSD.vfs.root.mountfrom=zfs:$name + kfreebsd_loadenv /@/boot/device.hints + } + + menuentry "FreeBSD ($fstype $device) (Default boot loader)" $device $uuid { + set root=$2 + + kfreebsd /@/boot/loader + } + +} + +function get_efis { + blockdev="$1" + blockfs="$2" + efis="" + if [ "$blockfs" = "fat" ]; then + for efi in ($blockdev)/efi/*/*.efi ($blockdev)/efi/*/*/*.efi \ + ($blockdev)/*.efi ($blockdev)/*/*.efi ; do + if [ -f "$efi" ] ; then + efis="$efis $efi" + fi + done + if [ -n "$efis" ]; then + return 0 + fi + fi + return 1 +} + +insmod regexp + + +for dev in (*); do + # $device: parenthesis removed from $dev + regexp -s device '\((.*)\)' $dev + # Discard floppy and cdrom devices in search + # But search them if their search has been inforced + + if searchindevice "$device" ; then + + + # $fstype: filesystem type identified + probe -s fstype -f $dev + # uuid: filesystem UUID + probe -s uuid -u $dev + + if test -f ($device)/bootmgr -a -f ($device)/boot/bcd; then + menuentry "Windows Vista ($device)" $device { + set root=$2 + chainloader +1 + } + elif test -f ($device)/ntldr -a \ + -e ($device)/ntdetect.com -a -f ($device)/boot.ini; then + menuentry "Windows NT/2000/XP ($device)" $device { + set root=$2 + regexp -s devnum 'hd([0-9]+)' $root + if test "$devnum" != "0"; then + drivemap -s hd0 $root + fi + chainloader +1 + } + elif test -f ($device)/windows/win.com; then + menuentry "Windows 98/ME ($device)" $device { + set root=$2 + regexp -s devnum 'hd([0-9]+)' $root + if test "$devnum" != "0"; then + drivemap -s hd0 $root + fi + chainloader +1 + } + elif test -f ($device)/io.sys -a -f ($device)/command.com; then + menuentry "MS-DOS ($device)" $device { + set root=$2 + regexp -s devnum 'hd([0-9]+)' $root + if test "$devnum" != "0"; then + drivemap -s hd0 $root + fi + chainloader +1 + } + elif test -f ($device)/kernel.sys; then + menuentry "FreeDOS ($device)" $device { + set root=$2 + regexp -s type '([fh])d[0-9]+' $root + regexp -s devnum '[fh]d([0-9]+)' $root + if test $type = 'h' -a "$devnum" != "0"; then + drivemap -s hd0 $root + fi + chainloader +1 + } + elif test "$fstype" = ufs1 -o "$fstype" = ufs2 -a \ + -e ($device)/boot/kernel/kernel -a \ + -e ($device)/boot/device.hints; then + + freebsd_ufs_variants $device $fstype $uuid + + elif test "$fstype" = zfs -a \ + -e ($device)/@/boot/kernel/kernel -a \ + -e ($device)/@/boot/device.hints; then + + freebsd_zfs_variants $device + + elif test "$fstype" = hfsplus -a -f ($device)/mach_kernel; then + menuentry "Mac OS X/Darwin" $device $uuid { + set root=$2 + set uuid=$3 + + insmod vbe + do_resume=0 + if [ /var/vm/sleepimage -nt10 / ]; then + if xnu_resume /var/vm/sleepimage; then + do_resume=1 + fi + fi + if [ $do_resume = 1 ]; then + xnu_uuid $uuid uuid + if [ -f /Extra/DSDT.aml ]; then + acpi -e /Extra/DSDT.aml + fi + xnu_kernel /mach_kernel boot-uuid=${uuid} rd=*uuid + if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then + xnu_mkext /System/Library/Extensions.mkext + else + xnu_mkext /System/Library/Extensions + fi + if [ -f /Extra/Extensions.mkext ]; then + xnu_mkext /Extra/Extensions.mkext + fi + if [ -d /Extra/Extensions ]; then + xnu_kextdir /Extra/Extensions + fi + if [ -f /Extra/devtree.txt ]; then + xnu_devtree /Extra/devtree.txt + fi + if [ -f /Extra/splash.jpg ]; then + insmod jpeg + xnu_splash /Extra/splash.jpg + fi + if [ -f /Extra/splash.png ]; then + insmod png + xnu_splash /Extra/splash.png + fi + if [ -f /Extra/splash.tga ]; then + insmod tga + xnu_splash /Extra/splash.tga + fi + fi + } + elif get_efis $device $fstype; then + for efi in $efis; do + menuentry "$efi" "$device" { + efi_device="$2" + efi="$1" + if [ "$grub_platform" = "efi" ]; then + root="$efi_device" + chainloader "$efi" + else + echo $"Sorry, but we are booted via BIOS and can not load this OS." + echo $"Please try booting SG2D via UEFI." + echo $"Press escape to return to the menu" + sleep --interruptible 9999 + fi + } + done + else + set root=$device + for file in /boot/vmlinuz-* /boot/linux-*; do + if test -f $file; then + regexp -s version '/boot/vmlinuz-(.*)' $file + regexp -s version '/boot/linux-(.*)' $file + + menuentry "Linux $file" $device $uuid $file $version { + set root=$2 + set uuid=$3 + set kernel=$4 + set version=$5 + + linux $kernel root=UUID=$uuid ro + if test -f /boot/initrd-$version.img; then + initrd /boot/initrd-$version.img + elif test -f /boot/initrd.img-$version; then + initrd /boot/initrd.img-$version + elif test -f /boot/initrd-$version; then + initrd /boot/initrd-$version + elif test -f /boot/initrd.gz; then + initrd /boot/initrd.gz + fi + } + + menuentry "Linux $file (single)" $device $uuid $file $version { + set root=$2 + set uuid=$3 + set kernel=$4 + set version=$5 + + linux $kernel root=UUID=$uuid ro single + if test -f /boot/initrd-$version.img; then + initrd /boot/initrd-$version.img + elif test -f /boot/initrd.img-$version; then + initrd /boot/initrd.img-$version + elif test -f /boot/initrd-$version; then + initrd /boot/initrd-$version + elif test -f /boot/initrd.gz; then + initrd /boot/initrd.gz + fi + } + fi + done + fi + fi +done + +set root=$saved_root diff --git a/EFI/BOOT/tools.cfg b/EFI/BOOT/tools.cfg new file mode 100644 index 0000000..22675b2 --- /dev/null +++ b/EFI/BOOT/tools.cfg @@ -0,0 +1,43 @@ +# This file is part of Super GRUB2 Disk. +# +# Copyright (C) 2013 Adrian Gibanel +# +# Super GRUB2 Disk is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Super GRUB2 Disk is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# This script contains several helper functions used in other cfg files . + + + +# Function: searchindevice +# According to global variables +# Return 0 (true) if the device should be searched for OS / cfgs / etc. +# Return 1 (false) if it should not be searched +# +# Device should be entered without () +# Input example: fd0 +# +# TODO: To be simplified when test function is fixed in upstream GRUB2 +function searchindevice { + + set device=$1 + + if [ '(' "$device" != "fd0" -a "$device" != "cd" ')' \ + -o \ + '(' "$device" = "fd0" -a "$fd0search" = "yes" ')' \ + -o \ + '(' "$device" = "cd" -a "$cdsearch" = "yes" ')' ] \ + ; then + return 0; + else + return 1; + fi + +} -- cgit v1.2.3