# Super Grub Disk Main Configuration file # Copyright (C) 2009 Adrian Gibanel Lopez. # # Super Grub 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 Grub 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. # # You should have received a copy of the GNU General Public License # along with GRUB. If not, see . # Configure gfxterm, but allow it to be disabled by holding shift during boot. # gfxterm is required to display non-ASCII translations. loadfont "$prefix/unifont.pf2" if keystatus --shift; then disable_gfxterm=true # export disable_gfxterm is needed so that the setting will persist even after # a "configfile /boot/grub/main.cfg" (which is what language_select.cfg does after # you select a new language) export disable_gfxterm # The following strings are intentionally not made translateable. echo "It has been detected that the shift key was held down. Because of this SG2D" echo "will use VGA text mode rather than gfxterm. This will cause display problems" echo "when using some non-English translations." echo echo "Press escape to continue to the main menu" sleep --interruptible 9999 fi if [ "$disable_gfxterm" != true ]; then insmod all_video gfxmode=640x480 if terminal_output --append gfxterm; \ then \ terminal_output --remove console; \ fi fi # Export the variables so that they persist when loading a new menu. export menu_color_normal export menu_color_highlight export menu_color_background export bwcolor function set_sgd_colors { if [ "$bwcolor" = "yes" ]; then menu_color_normal=white/black menu_color_highlight=black/white menu_color_background=black/white else menu_color_normal=white/brown menu_color_highlight=white/blue menu_color_background=yellow/cyan fi } set_sgd_colors # Set secondary_locale_dir to the directory containing SG2D specific mo files. # This makes grub aware of translations for SG2D specific strings. secondary_locale_dir="${prefix}/sgd_locale/" insmod part_acorn insmod part_amiga insmod part_apple insmod part_bsd insmod part_gpt insmod part_msdos insmod part_sun insmod part_sunpc # Prepare environment variables, needed mostly for update_paths() export prefix_device prefix_path prefix_uuid regexp -s prefix_device '^\((.*)\)/' "$prefix" regexp -s prefix_path '^\(.*\)/(.*)$' "$prefix" probe --fs-uuid --set=prefix_uuid "$prefix_device" # Define a function for updating paths when device names change. # search.mod is required for update-paths, and must be loaded before device # names change because $prefix will be invalid. insmod search function update_paths { search --fs-uuid --set=prefix_device $prefix_uuid prefix="($prefix_device)/$prefix_path" } function process_option { set option_cfg="$1" source ${option_cfg} menuentry ${option_title} { source ${option_cfg} run_option } } # Timeout for menu #set timeout=10 # Set default boot entry as Entry number 2 (counting from 0) set default=2 # Get the version number for this Super GRUB2 Disk release source "${prefix}/version.cfg" # Get design variables source "${prefix}/design.cfg" menuentry " ====---==- Super Grub2 Disk $sgrub_version -==---==== " { # Set pager=1 so ls output doesn't scroll past the top of the screen # but restore $pager to its previous value when finished set oldpager="${pager}" set pager=1 cat /boot/grub/AUTHORS cat /boot/grub/COPYING set pager="${oldpager}" unset oldpager echo $"Press escape to return to the main menu" sleep --interruptible 9999 } menuentry $"Languages..." { configfile "${prefix}/language_select.cfg" } # Everything menuentry $"Everything" { configfile "${prefix}/everything.cfg" } submenu $"Boot manually..." { process_option "${prefix}/osdetect.cfg" # Load cfgdetect script as a new menu menuentry $"grub.cfg - (GRUB2 configuration files)" { currentmenu_str=$"grub.cfg - (GRUB2 configuration files)" export currentmenu_str menuinteractive=yes export menuinteractive configfile "${prefix}/cfgdetect.cfg" } # Load menulstdetect script as a new menu menuentry $"menu.lst - (GRUB legacy configuration files)" { currentmenu_str=$"menu.lst - (GRUB legacy configuration files)" export currentmenu_str menuinteractive=yes export menuinteractive configfile "${prefix}/menulstdetect.cfg" } # Load grubdetect script as a new menu menuentry $"core.img - (GRUB2 installation (even if mbr is overwritten))" { currentmenu_str=$"core.img - (GRUB2 installation (even if mbr is overwritten))" export currentmenu_str menuinteractive=yes export menuinteractive configfile "${prefix}/grubdetect.cfg" } # Load autoiso script as a new menu menuentry $"Bootable ISOs (in /boot-isos or /boot/boot-isos)" { currentmenu_str=$"Bootable ISOs (in /boot-isos or /boot/boot-isos)" export currentmenu_str menuinteractive=yes export menuinteractive configfile "${prefix}/autoiso.cfg" } } submenu $"Extra GRUB2 functionality..." { menuentry $"Enable GRUB2's LVM support" { insmod lvm echo $"Press escape to return to the main menu (or wait 5 seconds)" sleep --interruptible 5 configfile "${prefix}/main.cfg" } menuentry $"Enable GRUB2's RAID support" { insmod dm_nv insmod mdraid09_be insmod mdraid09 insmod mdraid1x insmod raid5rec insmod raid6rec echo $"Press escape to return to the main menu (or wait 5 seconds)" sleep --interruptible 5 configfile "${prefix}/main.cfg" } menuentry $"Enable GRUB2's PATA support (to work around BIOS bugs/limitations)" { insmod ata update_paths echo $"Press escape to return to the main menu (or wait 5 seconds)" sleep --interruptible 5 configfile "${prefix}/main.cfg" } menuentry $"Enable GRUB2's USB support *experimental*" { insmod ohci insmod uhci insmod usbms update_paths echo $"Press escape to return to the main menu (or wait 5 seconds)" sleep --interruptible 5 configfile "${prefix}/main.cfg" } menuentry $"Mount encrypted volumes (LUKS and geli)" { insmod luks insmod geli cryptomount -a echo $"Press escape to return to the main menu (or wait 5 seconds)" sleep --interruptible 5 configfile "${prefix}/main.cfg" } menuentry $"Enable serial terminal" { serial terminal_input --append serial terminal_output --append serial echo $"Press escape to return to the main menu (or wait 5 seconds)" sleep --interruptible 5 configfile "${prefix}/main.cfg" } source "${prefix}/return.cfg" } submenu $"Extra Search functionality..." { menuentry $"Search in floppy ON/OFF (Default: OFF)" { if [ "$fd0search" = 'yes' ]; then fd0search=no else fd0search=yes fi export fd0search echo $"Search in FLOPPY: ${fd0search}" echo $"Press escape to return to the main menu (or wait 5 seconds)" sleep --interruptible 5 configfile "${prefix}/main.cfg" } menuentry $"Search in CDROM ON/OFF (Default: OFF)" { if [ "$cdsearch" = 'yes' ]; then cdsearch=no else cdsearch=yes fi export cdsearch echo $"Search in CDROM: ${cdsearch}" echo $"Press escape to return to the main menu (or wait 5 seconds)" sleep --interruptible 5 configfile "${prefix}/main.cfg" } source "${prefix}/return.cfg" } menuentry $"List devices/partitions" { # Set pager=1 so ls output doesn't scroll past the top of the screen # but restore $pager to its previous value when finished set oldpager="${pager}" set pager=1 ls -l set pager="${oldpager}" unset oldpager echo $"Press escape to return to the main menu" sleep --interruptible 9999 } menuentry $"Color ON/OFF" { if [ "$bwcolor" = 'yes' ]; then bwcolor=no else bwcolor=yes fi set_sgd_colors } # If it exists, source $prefix/sgd_custom.cfg. This follows the same idea as # grub-mkconfig generated grub.cfg files sourcing $prefix/custom.cfg, though # it's less needed here since one could add custom code to this file directly # whereas their distro might automatically overwrite /boot/grub/grub.cfg on # kernel upgrades. The main motivation for adding this was the vmtest script # which I use heavily during Super GRUB2 Disk development, but this feature # might also be useful to others. if [ -e "$prefix/sgd_custom.cfg" ]; then source "$prefix/sgd_custom.cfg" fi