From 83f7fe4b8402bab171d110703a1b1115efbc9b28 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 14 Apr 2026 22:32:43 +0200 Subject: cleaned up many scrits and deleted some that were of no use; renamed a lot --- straper/db/public/boot/grub.d/00_header | 421 ------------------------- straper/db/public/boot/grub.d/05_debian_theme | 199 ------------ straper/db/public/boot/grub.d/10_linux | 410 ------------------------ straper/db/public/boot/grub.d/20_linux_xen | 385 ---------------------- straper/db/public/boot/grub.d/25_bli | 24 -- straper/db/public/boot/grub.d/30_os-prober | 371 ---------------------- straper/db/public/boot/grub.d/30_uefi-firmware | 42 --- straper/db/public/boot/grub.d/35_fwupd | 24 -- straper/db/public/boot/grub.d/40_custom | 5 - straper/db/public/boot/grub.d/41_custom | 9 - straper/db/public/boot/grub.d/README | 11 - 11 files changed, 1901 deletions(-) delete mode 100755 straper/db/public/boot/grub.d/00_header delete mode 100755 straper/db/public/boot/grub.d/05_debian_theme delete mode 100755 straper/db/public/boot/grub.d/10_linux delete mode 100755 straper/db/public/boot/grub.d/20_linux_xen delete mode 100755 straper/db/public/boot/grub.d/25_bli delete mode 100755 straper/db/public/boot/grub.d/30_os-prober delete mode 100755 straper/db/public/boot/grub.d/30_uefi-firmware delete mode 100755 straper/db/public/boot/grub.d/35_fwupd delete mode 100755 straper/db/public/boot/grub.d/40_custom delete mode 100755 straper/db/public/boot/grub.d/41_custom delete mode 100644 straper/db/public/boot/grub.d/README (limited to 'straper/db/public/boot/grub.d') diff --git a/straper/db/public/boot/grub.d/00_header b/straper/db/public/boot/grub.d/00_header deleted file mode 100755 index 62f6468..0000000 --- a/straper/db/public/boot/grub.d/00_header +++ /dev/null @@ -1,421 +0,0 @@ -#! /bin/sh -set -e - -# grub-mkconfig helper script. -# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. -# -# 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 . - -prefix="/usr" -exec_prefix="/usr" -datarootdir="/usr/share" -grub_lang=`echo $LANG | cut -d . -f 1` -grubdir="`echo "/boot/grub" | sed 's,//*,/,g'`" -quick_boot="0" - -export TEXTDOMAIN=grub -export TEXTDOMAINDIR="${datarootdir}/locale" - -. "$pkgdatadir/grub-mkconfig_lib" - -# Do this as early as possible, since other commands might depend on it. -# (e.g. the `loadfont' command might need lvm or raid modules) -for i in ${GRUB_PRELOAD_MODULES} ; do - echo "insmod $i" -done - -if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi -if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi -if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi -if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi - -if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi -if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi -if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi - -cat << EOF -if [ -s \$prefix/grubenv ]; then - set have_grubenv=true - load_env -fi -EOF -if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then - cat < /dev/null ; then - font_path="${path}" - else - continue - fi - break 2 - done - done - if [ -n "${font_path}" ] ; then - cat << EOF -if [ x\$feature_default_font_path = xy ] ; then - font=unicode -else -EOF - # Make the font accessible - prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"` - cat << EOF - font="`make_system_path_relative_to_its_root "${font_path}"`" -fi - -if loadfont \$font ; then -EOF - else - cat << EOF -if loadfont unicode ; then -EOF - fi - fi - - cat << EOF - set gfxmode=${GRUB_GFXMODE} - load_video - insmod gfxterm -EOF - -# Gettext variables and module -if [ "x${grub_lang}" != "xC" ] && [ "x${LANG}" != "xPOSIX" ] && [ "x${LANG}" != "x" ]; then - cat << EOF - set locale_dir=\$prefix/locale - set lang=${grub_lang} - insmod gettext -EOF -fi - -cat <&2 - - prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"` - cat << EOF -insmod gfxmenu -EOF - themedir="`dirname "$GRUB_THEME"`" - for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do - if [ -f "$x" ]; then - cat << EOF -loadfont (\$root)`make_system_path_relative_to_its_root $x` -EOF - fi - done - if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then - cat << EOF -insmod jpeg -EOF - fi - if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then - cat << EOF -insmod png -EOF - fi - if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then - cat << EOF -insmod tga -EOF - fi - - cat << EOF -set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME` -export theme -EOF - elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \ - && is_path_readable_by_grub "$GRUB_BACKGROUND"; then - gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2 - case "$GRUB_BACKGROUND" in - *.png) reader=png ;; - *.tga) reader=tga ;; - *.jpg|*.jpeg) reader=jpeg ;; - *) gettext "Unsupported image format" >&2; echo >&2; exit 1 ;; - esac - prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` - cat << EOF -insmod $reader -background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"` -EOF - fi -fi - -make_timeout () -{ - cat << EOF -if [ "\${recordfail}" = 1 ] ; then - set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30} -else -EOF - if [ "x${3}" != "x" ] ; then - timeout="${2}" - style="${3}" - elif [ "x${1}" != "x" ] && \ - ([ "$quick_boot" = 1 ] || [ "x${1}" != "x0" ]) ; then - # Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme. - timeout="${1}" - if [ "x${2}" != "x0" ] ; then - grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.")" - fi - if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then - style="hidden" - verbose= - else - style="countdown" - verbose=" --verbose" - fi - else - # No hidden timeout, so treat as GRUB_TIMEOUT_STYLE=menu - timeout="${2}" - style="menu" - fi - cat << EOF - if [ x\$feature_timeout_style = xy ] ; then - set timeout_style=${style} - set timeout=${timeout} -EOF - if [ "x${style}" = "xmenu" ] ; then - cat << EOF - # Fallback normal timeout code in case the timeout_style feature is - # unavailable. - else - set timeout=${timeout} -EOF - else - cat << EOF - # Fallback hidden-timeout code in case the timeout_style feature is - # unavailable. - elif sleep${verbose} --interruptible ${timeout} ; then - set timeout=0 -EOF - fi - cat << EOF - fi -fi -EOF -if [ "$recordfail_broken" = 1 ]; then - cat << EOF -if [ \$grub_platform = efi ]; then - set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30} - if [ x\$feature_timeout_style = xy ] ; then - set timeout_style=menu - fi -fi -EOF -fi -} - -if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then - cat < -# -# 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 . - -# Include the GRUB helper library for grub-mkconfig. -. /usr/share/grub/grub-mkconfig_lib - -# We want to work in /boot/grub/ only. -test -d /boot/grub; cd /boot/grub - -# Set the location of a possibly necessary cache file for the background image. -# NOTE: This MUST BE A DOTFILE to avoid confusing it with user-defined images. -BACKGROUND_CACHE=".background_cache" - -set_default_theme(){ - case $GRUB_DISTRIBUTOR in - Tanglu|Ubuntu|Kubuntu) - # Set a monochromatic theme for Tanglu/Ubuntu. - echo "${1}set menu_color_normal=white/black" - echo "${1}set menu_color_highlight=black/light-gray" - - if [ -e /usr/share/plymouth/themes/default.grub ]; then - sed "s/^/${1}/" /usr/share/plymouth/themes/default.grub - fi - # For plymouth backward compatibility. Can be removed - # after xenial. - if [ -e /lib/plymouth/themes/default.grub ]; then - sed "s/^/${1}/" /lib/plymouth/themes/default.grub - fi - ;; - *) - # Set the traditional Debian blue theme. - echo "${1}set menu_color_normal=cyan/blue" - echo "${1}set menu_color_highlight=white/blue" - ;; - esac -} - -module_available(){ - local module - for module in "${1}.mod" */"${1}.mod"; do - if [ -f "${module}" ]; then - return 0 - fi - done - return 1 -} - -set_background_image(){ - # Step #1: Search all available output modes ... - local output - for output in ${GRUB_TERMINAL_OUTPUT}; do - if [ "x$output" = "xgfxterm" ]; then - break - fi - done - - # ... and check if we are able to display a background image at all. - if ! [ "x${output}" = "xgfxterm" ]; then - return 1 - fi - - # Step #2: Check if the specified background image exists. - if ! [ -f "${1}" ]; then - return 2 - fi - - # Step #3: Search the correct GRUB module for our background image. - local reader - case "${1}" in - *.jpg|*.JPG|*.jpeg|*.JPEG) reader="jpeg";; - *.png|*.PNG) reader="png";; - *.tga|*.TGA) reader="tga";; - *) return 3;; # Unknown image type. - esac - - # Step #4: Check if the necessary GRUB module is available. - if ! module_available "${reader}"; then - return 4 - fi - - # Step #5: Check if GRUB can read the background image directly and - # it is in the same filesystem as /boot/grub. - # If so, we can remove the cache file (if any). Otherwise the background - # image needs to be cached under /boot/grub/. - if is_path_readable_by_grub "${1}" && - [ "`${grub_probe} --target=device "${1}"`" = "`${grub_probe} --target=device .`" ]; then - rm --force "${BACKGROUND_CACHE}.jpeg" \ - "${BACKGROUND_CACHE}.png" "${BACKGROUND_CACHE}.tga" - elif cp "${1}" "${BACKGROUND_CACHE}.${reader}"; then - set -- "${BACKGROUND_CACHE}.${reader}" "${2}" "${3}" - else - return 5 - fi - - # Step #6: Prepare GRUB to read the background image. - if ! prepare_grub_to_access_device "`${grub_probe} --target=device "${1}"`"; then - return 6 - fi - - # Step #7: Everything went fine, print out a message to stderr ... - echo "Found background image: ${1}" >&2 - - # ... and write our configuration snippet to stdout. Use the colors - # desktop-base specified. If we're using a user-defined background, use - # the default colors since we've got no idea how the image looks like. - # If loading the background image fails, use the default theme. - echo "insmod ${reader}" - echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then" - if [ -n "${2}" ]; then - echo " set color_normal=${2}" - fi - if [ -n "${3}" ]; then - echo " set color_highlight=${3}" - fi - if [ -z "${2}" ] && [ -z "${3}" ]; then - echo " true" - fi - echo "else" - set_default_theme " " - echo "fi" -} - -# Earlier versions of grub-pc copied the default background image to /boot/grub -# during postinst. Remove those obsolete images if they haven't been touched by -# the user. They are still available under /usr/share/images/desktop-base/ if -# desktop-base is installed. -while read checksum background; do - if [ -f "${background}" ] && [ "x`sha1sum "${background}"`" = "x${checksum} ${background}" ]; then - echo "Removing old background image: ${background}" >&2 - rm "${background}" - fi -done <. - -prefix="/usr" -exec_prefix="/usr" -datarootdir="/usr/share" -ubuntu_recovery="0" -quiet_boot="0" -quick_boot="0" -gfxpayload_dynamic="0" -vt_handoff="0" - -. "$pkgdatadir/grub-mkconfig_lib" - -export TEXTDOMAIN=grub -export TEXTDOMAINDIR="${datarootdir}/locale" - -CLASS="--class gnu-linux --class gnu --class os" - -if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then - OS=GNU/Linux -else - case ${GRUB_DISTRIBUTOR} in - Ubuntu|Kubuntu|*GNU/Linux) - OS="${GRUB_DISTRIBUTOR}" - ;; - *) - OS="${GRUB_DISTRIBUTOR} GNU/Linux" - ;; - esac - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" -fi - -# loop-AES arranges things so that /dev/loop/X can be our root device, but -# the initrds that Linux uses don't like that. -case ${GRUB_DEVICE} in - /dev/loop/*|/dev/loop[0-9]) - GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` - # We can't cope with devices loop-mounted from files here. - case ${GRUB_DEVICE} in - /dev/*) ;; - *) exit 0 ;; - esac - ;; -esac - -if [ -x /lib/recovery-mode/recovery-menu ]; then - : ${GRUB_CMDLINE_LINUX_RECOVERY:=recovery} -else - : ${GRUB_CMDLINE_LINUX_RECOVERY:=single} -fi - -# Default to disabling partition uuid support to maintian compatibility with -# older kernels. -: ${GRUB_DISABLE_LINUX_PARTUUID=true} - -# 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_DEVICE_PARTUUID}" = "x" ] ) \ - || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - && [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \ - || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ - && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \ - || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} -elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \ - || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then - LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID} -else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -fi - -case x"$GRUB_FS" in - xbtrfs) - 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 || zdb -l ${GRUB_DEVICE} | awk -F \' '/ name/ { print $2 }'` - bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" - LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}" - ;; -esac - -title_correction_code= - -if [ "$ubuntu_recovery" = 1 ]; then - GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY nomodeset" -fi - -if [ "$vt_handoff" = 1 ]; then - for word in $GRUB_CMDLINE_LINUX_DEFAULT; do - if [ "$word" = splash ]; then - GRUB_CMDLINE_LINUX_DEFAULT="$GRUB_CMDLINE_LINUX_DEFAULT \$vt_handoff" - fi - done -fi - -linux_entry () -{ - os="$1" - version="$2" - type="$3" - args="$4" - - if [ -z "$boot_device_id" ]; then - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" - fi - if [ x$type != xsimple ] ; then - case $type in - recovery) - title="$(gettext_printf "%s, with Linux %s (%s)" "${os}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" ;; - *) - title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;; - esac - if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then - replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" - quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" - title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" - grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" - fi - echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" - else - echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" - fi - if [ "$quick_boot" = 1 ]; then - echo " recordfail" | sed "s/^/$submenu_indentation/" - fi - if [ x$type != xrecovery ] ; then - save_default_entry | grub_add_tab - fi - - # Use ELILO's generic "efifb" when it's known to be available. - # FIXME: We need an interface to select vesafb in case efifb can't be used. - if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then - echo " load_video" | sed "s/^/$submenu_indentation/" - else - if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then - echo " load_video" | sed "s/^/$submenu_indentation/" - fi - fi - if ([ "$ubuntu_recovery" = 0 ] || [ x$type != xrecovery ]) && \ - ([ "x$GRUB_GFXPAYLOAD_LINUX" != x ] || [ "$gfxpayload_dynamic" = 1 ]); then - echo " gfxmode \$linux_gfx_mode" | sed "s/^/$submenu_indentation/" - fi - - echo " insmod gzio" | sed "s/^/$submenu_indentation/" - echo " if [ x\$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi" | sed "s/^/$submenu_indentation/" - - 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 - printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/" - else - if [ -z "${prepare_boot_cache}" ]; then - prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)" - fi - printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" - fi - if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then - message="$(gettext_printf "Loading Linux %s ..." ${version})" - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' -EOF - fi - sed "s/^/$submenu_indentation/" << EOF - linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} -EOF - if test -n "${initrd}" ; then - # TRANSLATORS: ramdisk isn't identifier. Should be translated. - if [ x"$quiet_boot" = x0 ] || [ x"$type" != xsimple ]; then - message="$(gettext_printf "Loading initial ramdisk ...")" - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' -EOF - fi - initrd_path= - for i in ${initrd}; do - initrd_path="${initrd_path} ${rel_dirname}/${i}" - done - sed "s/^/$submenu_indentation/" << EOF - initrd $(echo $initrd_path) -EOF - fi - sed "s/^/$submenu_indentation/" << EOF -} -EOF -} - -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 list="$list $i" ; fi - done ;; - *) - list= - for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do - if grub_file_is_not_garbage "$i" ; then list="$list $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="$machine" ;; -esac - -case "$GENKERNEL_ARCH" in - x86*) GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY dis_ucode_ldr";; -esac - -prepare_boot_cache= -prepare_root_cache= -boot_device_id= -title_correction_code= - -cat << 'EOF' -function gfxmode { - set gfxpayload="${1}" -EOF -if [ "$vt_handoff" = 1 ]; then - cat << 'EOF' - if [ "${1}" = "keep" ]; then - set vt_handoff=vt.handoff=7 - else - set vt_handoff= - fi -EOF -fi -cat << EOF -} -EOF - -# Use ELILO's generic "efifb" when it's known to be available. -# FIXME: We need an interface to select vesafb in case efifb can't be used. -if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ] || [ "$gfxpayload_dynamic" = 0 ]; then - echo "set linux_gfx_mode=$GRUB_GFXPAYLOAD_LINUX" -else - cat << EOF -if [ "\${recordfail}" != 1 ]; then - if [ -e \${prefix}/gfxblacklist.txt ]; then - if [ \${grub_platform} != pc ]; then - set linux_gfx_mode=keep - elif hwmatch \${prefix}/gfxblacklist.txt 3; then - if [ \${match} = 0 ]; then - set linux_gfx_mode=keep - else - set linux_gfx_mode=text - fi - else - set linux_gfx_mode=text - fi - else - set linux_gfx_mode=keep - fi -else - set linux_gfx_mode=text -fi -EOF -fi -cat << EOF -export linux_gfx_mode -EOF - -# Extra indentation to add to menu entries in a submenu. We're not in a submenu -# yet, so it's empty. In a submenu it will be equal to '\t' (one tab). -submenu_indentation="" - -# Perform a reverse version sort on the entire list. -# Temporarily replace the '.old' suffix by ' 1' and append ' 2' for all -# other files to order the '.old' files after their non-old counterpart -# in reverse-sorted order. - -reverse_sorted_list=$(echo $list | tr ' ' '\n' | sed -e 's/\.old$/ 1/; / 1$/! s/$/ 2/' | version_sort -r | sed -e 's/ 1$/.old/; s/ 2$//') - -if [ "x$GRUB_TOP_LEVEL" != x ]; then - reverse_sorted_list=$(grub_move_to_front "$GRUB_TOP_LEVEL" ${reverse_sorted_list}) -fi - -is_top_level=true -for linux in ${reverse_sorted_list}; do - gettext_printf "Found linux image: %s\n" "$linux" >&2 - basename=`basename $linux` - dirname=`dirname $linux` - rel_dirname=`make_system_path_relative_to_its_root $dirname` - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` - alt_version=`echo $version | sed -e "s,\.old$,,g"` - linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" - - initrd_early= - for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \ - ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do - if test -e "${dirname}/${i}" ; then - initrd_early="${initrd_early} ${i}" - fi - done - - initrd_real= - for i in "initrd.img-${version}" "initrd-${version}.img" \ - "initrd-${alt_version}.img.old" "initrd-${version}.gz" \ - "initrd-${alt_version}.gz.old" "initrd-${version}" \ - "initramfs-${version}.img" "initramfs-${alt_version}.img.old" \ - "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ - "initrd-${alt_version}" "initramfs-${alt_version}.img" \ - "initramfs-genkernel-${version}" \ - "initramfs-genkernel-${alt_version}" \ - "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ - "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do - if test -e "${dirname}/${i}" ; then - initrd_real="${i}" - break - fi - done - - initrd= - if test -n "${initrd_early}" || test -n "${initrd_real}"; then - initrd="${initrd_early} ${initrd_real}" - - initrd_display= - for i in ${initrd}; do - initrd_display="${initrd_display} ${dirname}/${i}" - done - gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 - fi - - config= - for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do - if test -e "${i}" ; then - config="${i}" - break - fi - done - - initramfs= - if test -n "${config}" ; then - initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` - fi - - if test -z "${initramfs}" && test -z "${initrd_real}" ; then - # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's - # no initrd or builtin initramfs, it can't work here. - if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \ - || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then - - linux_root_device_thisversion=${GRUB_DEVICE} - else - linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID} - fi - fi - - # The GRUB_DISABLE_SUBMENU option used to be different than others since it was - # mentioned in the documentation that has to be set to 'y' instead of 'true' to - # enable it. This caused a lot of confusion to users that set the option to 'y', - # 'yes' or 'true'. This was fixed but all of these values must be supported now. - if [ "x${GRUB_DISABLE_SUBMENU}" = xyes ] || [ "x${GRUB_DISABLE_SUBMENU}" = xy ]; then - GRUB_DISABLE_SUBMENU="true" - fi - - if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then - linux_entry "${OS}" "${version}" simple \ - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - - submenu_indentation="$grub_tab" - - if [ -z "$boot_device_id" ]; then - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" - fi - # TRANSLATORS: %s is replaced with an OS name - echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" - is_top_level=false - fi - - linux_entry "${OS}" "${version}" advanced \ - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then - linux_entry "${OS}" "${version}" recovery \ - "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" - fi -done - -# If at least one kernel was found, then we need to -# add a closing '}' for the submenu command. -if [ x"$is_top_level" != xtrue ]; then - echo '}' -fi - -echo "$title_correction_code" diff --git a/straper/db/public/boot/grub.d/20_linux_xen b/straper/db/public/boot/grub.d/20_linux_xen deleted file mode 100755 index 8887f44..0000000 --- a/straper/db/public/boot/grub.d/20_linux_xen +++ /dev/null @@ -1,385 +0,0 @@ -#! /bin/sh -set -e - -# grub-mkconfig helper script. -# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. -# -# 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 . - -prefix="/usr" -exec_prefix="/usr" -datarootdir="/usr/share" - -. "$pkgdatadir/grub-mkconfig_lib" - -export TEXTDOMAIN=grub -export TEXTDOMAINDIR="${datarootdir}/locale" - -CLASS="--class gnu-linux --class gnu --class os --class xen" - -if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then - OS=GNU/Linux -else - OS="${GRUB_DISTRIBUTOR} GNU/Linux" - CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}" -fi - -# loop-AES arranges things so that /dev/loop/X can be our root device, but -# the initrds that Linux uses don't like that. -case ${GRUB_DEVICE} in - /dev/loop/*|/dev/loop[0-9]) - GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` - # We can't cope with devices loop-mounted from files here. - case ${GRUB_DEVICE} in - /dev/*) ;; - *) exit 0 ;; - esac - ;; -esac - -: ${GRUB_CMDLINE_LINUX_RECOVERY:=single} - -# Default to disabling partition uuid support to maintian compatibility with -# older kernels. -: ${GRUB_DISABLE_LINUX_PARTUUID=true} - -# 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_DEVICE_PARTUUID}" = "x" ] ) \ - || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - && [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \ - || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ - && ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \ - || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} -elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \ - || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then - LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID} -else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -fi - -# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT. -if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then - GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}" -fi -if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then - GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" -fi - -case x"$GRUB_FS" in - xbtrfs) - 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 || zdb -l ${GRUB_DEVICE} | awk -F \' '/ name/ { print $2 }'` - bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`" - LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}" - ;; -esac - -title_correction_code= - -linux_entry () -{ - linux_entry_xsm "$@" false - linux_entry_xsm "$@" true -} -linux_entry_xsm () -{ - os="$1" - version="$2" - entry_xen_version="$3" - type="$4" - args="$5" - xen_args="$6" - xsm="$7" - # If user wants to enable XSM support, make sure there's - # corresponding policy file. - xenpolicy= - if ${xsm} ; then - xenpolicy="xenpolicy-$entry_xen_version" - if test ! -e "${xen_dirname}/${xenpolicy}" ; then - return - fi - xen_args="$xen_args flask=enforcing" - entry_xen_version="$(gettext_printf "%s (XSM enabled)" "$entry_xen_version")" - # entry_xen_version is used for messages only; actual file is xen_basename - fi - if [ -z "$boot_device_id" ]; then - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" - fi - if [ x$type != xsimple ] ; then - if [ x$type = xrecovery ] ; then - title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${entry_xen_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" - else - title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${entry_xen_version}" "${version}")" - fi - replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" - if [ x"Xen ${entry_xen_version}>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then - quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" - title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" - grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" - fi - echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/" - else - title="$(gettext_printf "%s, with Xen hypervisor" "${os}")" - echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/" - fi - if [ x$type != xrecovery ] ; then - save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/" - fi - - if [ -z "${prepare_boot_cache}" ]; then - prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)" - fi - printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/" - xmessage="$(gettext_printf "Loading Xen %s ..." ${entry_xen_version})" - lmessage="$(gettext_printf "Loading Linux %s ..." ${version})" - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$xmessage" | grub_quote)' - if [ "\$grub_platform" = "pc" -o "\$grub_platform" = "" ]; then - xen_rm_opts= - else - xen_rm_opts="no-real-mode edd=off" - fi - ${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts} - echo '$(echo "$lmessage" | grub_quote)' - ${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args} -EOF - if test -n "${initrd}" ; then - # TRANSLATORS: ramdisk isn't identifier. Should be translated. - message="$(gettext_printf "Loading initial ramdisk ...")" - initrd_path= - for i in ${initrd}; do - initrd_path="${rel_dirname}/${i}" - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' - ${module_loader} --nounzip $(echo $initrd_path) -EOF - done - fi - if ${xsm} && test -n "${xenpolicy}" ; then - message="$(gettext_printf "Loading XSM policy ...")" - sed "s/^/$submenu_indentation/" << EOF - echo '$(echo "$message" | grub_quote)' - ${module_loader} ${rel_dirname}/${xenpolicy} -EOF - fi - sed "s/^/$submenu_indentation/" << EOF -} -EOF -} - -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 linux_list="$linux_list $i" ; fi - fi -done -if [ "x${linux_list}" = "x" ] ; then - exit 0 -fi - -file_is_not_xen_garbage () { - case "$1" in - */xen-syms-*) - return 1;; - */xenpolicy-*) - return 1;; - */*.config) - return 1;; - *) - return 0;; - esac -} - -xen_list= -for i in /boot/xen*; do - if grub_file_is_not_garbage "$i" && file_is_not_xen_garbage "$i" ; then xen_list="$xen_list $i" ; fi -done -prepare_boot_cache= -boot_device_id= - -title_correction_code= - -machine=`uname -m` - -case "$machine" in - i?86) GENKERNEL_ARCH="x86" ;; - mips|mips64) GENKERNEL_ARCH="mips" ;; - mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;; - arm*) GENKERNEL_ARCH="arm" ;; - *) GENKERNEL_ARCH="$machine" ;; -esac - -# Extra indentation to add to menu entries in a submenu. We're not in a submenu -# yet, so it's empty. In a submenu it will be equal to '\t' (one tab). -submenu_indentation="" - -# Perform a reverse version sort on the entire xen_list and linux_list. -# Temporarily replace the '.old' suffix by ' 1' and append ' 2' for all -# other files to order the '.old' files after their non-old counterpart -# in reverse-sorted order. - -reverse_sorted_xen_list=$(echo ${xen_list} | tr ' ' '\n' | sed -e 's/\.old$/ 1/; / 1$/! s/$/ 2/' | version_sort -r | sed -e 's/ 1$/.old/; s/ 2$//') -reverse_sorted_linux_list=$(echo ${linux_list} | tr ' ' '\n' | sed -e 's/\.old$/ 1/; / 1$/! s/$/ 2/' | version_sort -r | sed -e 's/ 1$/.old/; s/ 2$//') - -if [ "x$GRUB_TOP_LEVEL_XEN" != x ]; then - reverse_sorted_xen_list=$(grub_move_to_front "$GRUB_TOP_LEVEL_XEN" ${reverse_sorted_xen_list}) -fi -if [ "x$GRUB_TOP_LEVEL" != x ]; then - reverse_sorted_linux_list=$(grub_move_to_front "$GRUB_TOP_LEVEL" ${reverse_sorted_linux_list}) -fi - -is_top_level=true - -for current_xen in ${reverse_sorted_xen_list}; do - xen_basename=`basename ${current_xen}` - xen_dirname=`dirname ${current_xen}` - rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname` - xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"` - if [ -z "$boot_device_id" ]; then - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" - fi - if [ "x$is_top_level" != xtrue ]; then - echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" - fi - if ($grub_file --is-arm64-efi $current_xen); then - xen_loader="xen_hypervisor" - module_loader="xen_module" - else - if ($grub_file --is-x86-multiboot2 $current_xen); then - xen_loader="multiboot2" - module_loader="module2" - else - xen_loader="multiboot" - module_loader="module" - fi - fi - - initrd_early= - for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \ - ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do - if test -e "${xen_dirname}/${i}" ; then - initrd_early="${initrd_early} ${i}" - fi - done - - for linux in ${reverse_sorted_linux_list}; do - gettext_printf "Found linux image: %s\n" "$linux" >&2 - basename=`basename $linux` - dirname=`dirname $linux` - rel_dirname=`make_system_path_relative_to_its_root $dirname` - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` - alt_version=`echo $version | sed -e "s,\.old$,,g"` - linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" - - initrd_real= - for i in "initrd.img-${version}" "initrd-${version}.img" \ - "initrd-${alt_version}.img.old" "initrd-${version}.gz" \ - "initrd-${alt_version}.gz.old" "initrd-${version}" \ - "initramfs-${version}.img" "initramfs-${alt_version}.img.old" \ - "initrd.img-${alt_version}" "initrd-${alt_version}.img" \ - "initrd-${alt_version}" "initramfs-${alt_version}.img" \ - "initramfs-genkernel-${version}" \ - "initramfs-genkernel-${alt_version}" \ - "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \ - "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" ; do - if test -e "${dirname}/${i}" ; then - initrd_real="$i" - break - fi - done - - initrd= - if test -n "${initrd_early}" || test -n "${initrd_real}"; then - # Xen assumes the real initrd is the first module after the kernel. - # Additional (later) initrds can also be used for microcode update, - # with Xen option 'ucode= (non-default anyway). - initrd="${initrd_real} ${initrd_early}" - - initrd_display= - for i in ${initrd}; do - initrd_display="${initrd_display} ${dirname}/${i}" - done - gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2 - fi - - if test -z "${initrd_real}"; then - # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. - if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \ - || [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then - - linux_root_device_thisversion=${GRUB_DEVICE} - else - linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID} - fi - fi - - # The GRUB_DISABLE_SUBMENU option used to be different than others since it was - # mentioned in the documentation that has to be set to 'y' instead of 'true' to - # enable it. This caused a lot of confusion to users that set the option to 'y', - # 'yes' or 'true'. This was fixed but all of these values must be supported now. - if [ "x${GRUB_DISABLE_SUBMENU}" = xyes ] || [ "x${GRUB_DISABLE_SUBMENU}" = xy ]; then - GRUB_DISABLE_SUBMENU="true" - fi - - if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then - linux_entry "${OS}" "${version}" "${xen_version}" simple \ - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" - - submenu_indentation="$grub_tab$grub_tab" - - if [ -z "$boot_device_id" ]; then - boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")" - fi - # TRANSLATORS: %s is replaced with an OS name - echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {" - echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {" - is_top_level=false - fi - - linux_entry "${OS}" "${version}" "${xen_version}" advanced \ - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" - if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then - linux_entry "${OS}" "${version}" "${xen_version}" recovery \ - "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" - fi - done - if [ x"$is_top_level" != xtrue ]; then - echo ' }' - fi -done - -# If at least one kernel was found, then we need to -# add a closing '}' for the submenu command. -if [ x"$is_top_level" != xtrue ]; then - echo '}' -fi - -echo "$title_correction_code" diff --git a/straper/db/public/boot/grub.d/25_bli b/straper/db/public/boot/grub.d/25_bli deleted file mode 100755 index 26e27a0..0000000 --- a/straper/db/public/boot/grub.d/25_bli +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh -set -e - -# grub-mkconfig helper script. -# Copyright (C) 2023 Free Software Foundation, Inc. -# -# 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 . - -cat << EOF -if [ "\$grub_platform" = "efi" ]; then - insmod bli -fi -EOF diff --git a/straper/db/public/boot/grub.d/30_os-prober b/straper/db/public/boot/grub.d/30_os-prober deleted file mode 100755 index c984f7d..0000000 --- a/straper/db/public/boot/grub.d/30_os-prober +++ /dev/null @@ -1,371 +0,0 @@ -#! /bin/sh -set -e - -# grub-mkconfig helper script. -# Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc. -# -# 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 . - -prefix="/usr" -exec_prefix="/usr" -datarootdir="/usr/share" -quick_boot="0" - -export TEXTDOMAIN=grub -export TEXTDOMAINDIR="${datarootdir}/locale" - -. "$pkgdatadir/grub-mkconfig_lib" - -found_other_os= - -adjust_timeout () { - if [ "$quick_boot" = 1 ] && [ "x${found_other_os}" != "x" ]; then - cat << EOF -set timeout_style=menu -if [ "\${timeout}" = 0 ]; then - set timeout=10 -fi -EOF - fi -} - -if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober > /dev/null ; then - # missing os-prober and/or linux-boot-prober - exit 0 -fi - -if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then - grub_warn "$(gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.")" - exit 0 -fi - -grub_warn "$(gettext_printf "os-prober will be executed to detect other bootable partitions.\nIts output will be used to detect bootable binaries on them and create new boot entries.")" - -OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`" -if [ -z "${OSPROBED}" ] ; then - # empty os-prober output, nothing doing - exit 0 -fi - -osx_entry() { - found_other_os=1 - if [ x$2 = x32 ]; then - # TRANSLATORS: it refers to kernel architecture (32-bit) - bitstr="$(gettext "(32-bit)")" - else - # TRANSLATORS: it refers to kernel architecture (64-bit) - bitstr="$(gettext "(64-bit)")" - fi - # TRANSLATORS: it refers on the OS residing on device %s - onstr="$(gettext_printf "(on %s)" "${DEVICE}")" - cat << EOF -menuentry '$(echo "${LONGNAME} $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${DEVICE}")' { -EOF - save_default_entry | grub_add_tab - prepare_grub_to_access_device ${DEVICE} | grub_add_tab - cat << EOF - load_video - set do_resume=0 - if [ /var/vm/sleepimage -nt10 / ]; then - if xnu_resume /var/vm/sleepimage; then - set do_resume=1 - fi - fi - if [ \$do_resume = 0 ]; then - xnu_uuid ${OSXUUID} uuid - if [ -f /Extra/DSDT.aml ]; then - acpi -e /Extra/DSDT.aml - 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 - xnu_mkext /System/Library/Extensions.mkext - else - xnu_kextdir /System/Library/Extensions - fi - 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/devprop.bin ]; then - xnu_devprop_load /Extra/devprop.bin - 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 -} -EOF -} - -used_osprober_linux_ids= - -if [ "x$GRUB_TOP_LEVEL_OS_PROBER" != x ]; then - OSPROBED=$(grub_move_to_front "$GRUB_TOP_LEVEL_OS_PROBER" ${OSPROBED}) -fi - -for OS in ${OSPROBED} ; do - DEVICE="`echo ${OS} | cut -d ':' -f 1`" - LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`" - LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`" - BOOT="`echo ${OS} | cut -d ':' -f 4`" - if UUID="`${grub_probe} --target=fs_uuid --device ${DEVICE%@*}`"; then - EXPUUID="$UUID" - - if [ x"${DEVICE#*@}" != x ] ; then - EXPUUID="${EXPUUID}@${DEVICE#*@}" - fi - - 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`" - if [ "x$BTRFS" = "xbtrfs" ]; then - BTRFSuuid="`echo ${OS} | cut -d ':' -f 6`" - BTRFSsubvol="`echo ${OS} | cut -d ':' -f 7`" - fi - - if [ -z "${LONGNAME}" ] ; then - 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 - chain) - - onstr="$(gettext_printf "(on %s)" "${DEVICE}")" - cat << EOF -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 - - if [ x"`${grub_probe} --device ${DEVICE} --target=partmap`" = xmsdos ]; then - cat << EOF - parttool \${root} hidden- -EOF - fi - - case ${LONGNAME} in - Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*) - ;; - *) - cat << EOF - drivemap -s (hd0) \${root} -EOF - ;; - esac - - cat < /dev/null; do - counter=$((counter+1)); - done - if [ -z "$boot_device_id" ]; then - boot_device_id="$(grub_get_device_id "${DEVICE}")" - fi - used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'" - - # The GRUB_DISABLE_SUBMENU option used to be different than others since it was - # mentioned in the documentation that has to be set to 'y' instead of 'true' to - # enable it. This caused a lot of confusion to users that set the option to 'y', - # 'yes' or 'true'. This was fixed but all of these values must be supported now. - if [ "x${GRUB_DISABLE_SUBMENU}" = xyes ] || [ "x${GRUB_DISABLE_SUBMENU}" = xy ]; then - GRUB_DISABLE_SUBMENU="true" - fi - - if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then - cat << EOF -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}" - cat << EOF - linux ${LKERNEL} ${LPARAMS} -EOF - if [ -n "${LINITRD}" ] ; then - cat << EOF - initrd ${LINITRD} -EOF - fi - cat << EOF -} -EOF - echo "submenu '$(gettext_printf "Advanced options for %s" "${OS} $onstr" | grub_quote)' \$menuentry_id_option 'osprober-gnulinux-advanced-$boot_device_id' {" - is_top_level=false - fi - title="${LLABEL} $onstr" - cat << EOF - menuentry '$(echo "$title" | grub_quote)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'osprober-gnulinux-$LKERNEL-${recovery_params}-$boot_device_id' { -EOF - save_default_entry | sed -e "s/^/$grub_tab$grub_tab/" - printf '%s\n' "${prepare_boot_cache}" | grub_add_tab - cat << EOF - linux ${LKERNEL} ${LPARAMS} -EOF - if [ -n "${LINITRD}" ] ; then - cat << EOF - initrd ${LINITRD} -EOF - fi - cat << EOF - } -EOF - if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then - replacement_title="$(echo "Advanced options for ${OS} $onstr" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')" - quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)" - title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;" - grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")" - fi - done - if [ x"$is_top_level" != xtrue ]; then - echo '}' - fi - echo "$title_correction_code" - ;; - macosx) - if [ "${UUID}" ]; then - OSXUUID="${UUID}" - osx_entry xnu_kernel 32 - osx_entry xnu_kernel64 64 - fi - ;; - hurd) - found_other_os=1 - onstr="$(gettext_printf "(on %s)" "${DEVICE}")" - cat << EOF -menuentry '$(echo "${LONGNAME} $onstr" | grub_quote)' --class hurd --class gnu --class os \$menuentry_id_option 'osprober-gnuhurd-/boot/gnumach.gz-false-$(grub_get_device_id "${DEVICE}")' { -EOF - save_default_entry | grub_add_tab - prepare_grub_to_access_device ${DEVICE} | grub_add_tab - grub_device="`${grub_probe} --device ${DEVICE} --target=drive`" - mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`" - grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`" - case "${grub_fs}" in - *fs) hurd_fs="${grub_fs}" ;; - *) hurd_fs="${grub_fs}fs" ;; - esac - cat << EOF - multiboot /boot/gnumach.gz root=device:${mach_device} - module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\ - --multiboot-command-line='\${kernel-command-line}' \\ - --host-priv-port='\${host-port}' \\ - --device-master-port='\${device-port}' \\ - --exec-server-task='\${exec-task}' -T typed '\${root}' \\ - '\$(task-create)' '\$(task-resume)' - module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)' -} -EOF - ;; - minix) - cat << EOF -menuentry "${LONGNAME} (on ${DEVICE}, Multiboot)" { -EOF - save_default_entry | sed -e "s/^/\t/" - prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" - cat << EOF - multiboot /boot/image_latest -} -EOF - ;; - *) - # TRANSLATORS: %s is replaced by OS name. - gettext_printf "%s is not yet supported by grub-mkconfig.\n" " ${LONGNAME}" >&2 - ;; - esac -done - -adjust_timeout diff --git a/straper/db/public/boot/grub.d/30_uefi-firmware b/straper/db/public/boot/grub.d/30_uefi-firmware deleted file mode 100755 index 377913d..0000000 --- a/straper/db/public/boot/grub.d/30_uefi-firmware +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/sh -set -e - -# grub-mkconfig helper script. -# Copyright (C) 2020 Free Software Foundation, Inc. -# -# 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 . - -prefix="/usr" -exec_prefix="/usr" -datarootdir="/usr/share" - -export TEXTDOMAIN=grub -export TEXTDOMAINDIR="${datarootdir}/locale" - -. "$pkgdatadir/grub-mkconfig_lib" - -LABEL="UEFI Firmware Settings" - -gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2 - -cat << EOF -if [ "\$grub_platform" = "efi" ]; then - fwsetup --is-supported - if [ "\$?" = 0 ]; then - menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' { - fwsetup - } - fi -fi -EOF diff --git a/straper/db/public/boot/grub.d/35_fwupd b/straper/db/public/boot/grub.d/35_fwupd deleted file mode 100755 index ea46bcf..0000000 --- a/straper/db/public/boot/grub.d/35_fwupd +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh -# SPDX-License-Identifier: LGPL-2.1-or-later -set -e - -[ -d ${pkgdatadir:?} ] -# shellcheck source=/dev/null -. "$pkgdatadir/grub-mkconfig_lib" - -if [ -f /var/lib/fwupd/uefi_capsule.conf ] && - ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then - . /var/lib/fwupd/uefi_capsule.conf - if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then - echo "Adding Linux Firmware Updater entry" >&2 -cat << EOF -menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' { -EOF - ${grub_probe:?} --version > /dev/null - prepare_grub_to_access_device "$(${grub_probe} --target=device ${ESP})" | sed -e "s/^/\t/" -cat << EOF - chainloader ${EFI_PATH} -} -EOF - fi -fi diff --git a/straper/db/public/boot/grub.d/40_custom b/straper/db/public/boot/grub.d/40_custom deleted file mode 100755 index 48068de..0000000 --- a/straper/db/public/boot/grub.d/40_custom +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -exec tail -n +3 $0 -# This file provides an easy way to add custom menu entries. Simply type the -# menu entries you want to add after this comment. Be careful not to change -# the 'exec tail' line above. diff --git a/straper/db/public/boot/grub.d/41_custom b/straper/db/public/boot/grub.d/41_custom deleted file mode 100755 index a08363d..0000000 --- a/straper/db/public/boot/grub.d/41_custom +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -cat <