2024-10-14 15:20:36 +00:00
|
|
|
if [ -s $prefix/grubenv ] ; then
|
2024-10-06 19:47:09 +00:00
|
|
|
set have_grubenv=true
|
|
|
|
load_env
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${next_entry}" ] ; then
|
|
|
|
set default="${next_entry}"
|
|
|
|
set next_entry=
|
|
|
|
save_env next_entry
|
|
|
|
set boot_once=true
|
|
|
|
else
|
|
|
|
set default="0"
|
|
|
|
fi
|
|
|
|
|
2024-10-14 15:20:36 +00:00
|
|
|
if [ x"${feature_menuentry_id}" = xy ] ; then
|
2024-10-06 19:47:09 +00:00
|
|
|
menuentry_id_option="--id"
|
|
|
|
else
|
|
|
|
menuentry_id_option=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
export menuentry_id_option
|
|
|
|
|
2024-10-14 15:20:36 +00:00
|
|
|
if [ "${prev_saved_entry}" ] ; then
|
2024-10-06 19:47:09 +00:00
|
|
|
set saved_entry="${prev_saved_entry}"
|
|
|
|
save_env saved_entry
|
|
|
|
set prev_saved_entry=
|
|
|
|
save_env prev_saved_entry
|
|
|
|
set boot_once=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
function savedefault {
|
2024-10-14 15:20:36 +00:00
|
|
|
if [ -z "${boot_once}" ] ; then
|
2024-10-06 19:47:09 +00:00
|
|
|
saved_entry="${chosen}"
|
|
|
|
save_env saved_entry
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function recordfail {
|
|
|
|
set recordfail=1
|
2024-10-14 15:20:36 +00:00
|
|
|
if [ -n "${have_grubenv}" ] ; then
|
|
|
|
if [ -z "${boot_once}" ] ; then
|
|
|
|
save_env recordfail
|
2024-10-06 19:47:09 +00:00
|
|
|
fi;
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function load_video {
|
2024-10-14 15:20:36 +00:00
|
|
|
if [ x$feature_all_video_module = xy ] ; then
|
2024-10-06 19:47:09 +00:00
|
|
|
insmod all_video
|
|
|
|
else
|
|
|
|
insmod efi_gop
|
|
|
|
insmod efi_uga
|
|
|
|
insmod ieee1275_fb
|
|
|
|
insmod vbe
|
|
|
|
insmod vga
|
|
|
|
insmod video_bochs
|
|
|
|
insmod video_cirrus
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ x$feature_default_font_path = xy ] ; then
|
|
|
|
font=unicode
|
|
|
|
fi
|
|
|
|
|
|
|
|
if loadfont $font ; then
|
|
|
|
set gfxmode=auto
|
|
|
|
load_video
|
|
|
|
insmod gfxterm
|
|
|
|
set locale_dir=$prefix/locale
|
|
|
|
set lang=en_IN
|
|
|
|
insmod gettext
|
|
|
|
fi
|
|
|
|
|
|
|
|
terminal_output gfxterm
|
|
|
|
insmod part_msdos
|
|
|
|
insmod ext2
|
|
|
|
insmod gfxmenu
|
2024-10-14 15:20:36 +00:00
|
|
|
insmod regexp
|
2024-10-06 19:47:09 +00:00
|
|
|
|
|
|
|
function loadtheme {
|
2024-10-14 15:20:36 +00:00
|
|
|
theme_name=$1
|
2024-10-06 19:47:09 +00:00
|
|
|
|
|
|
|
insmod jpeg
|
|
|
|
insmod png
|
|
|
|
|
2024-10-14 15:20:36 +00:00
|
|
|
for font in (${root})/boot/grub/themes/${theme_name}/*.pf2 ; do
|
|
|
|
loadfont ${font}
|
2024-10-06 19:47:09 +00:00
|
|
|
done
|
|
|
|
|
2024-10-14 15:20:36 +00:00
|
|
|
set theme=(${root})/boot/grub/themes/${theme_name}/theme.txt
|
2024-10-06 19:47:09 +00:00
|
|
|
export theme
|
|
|
|
|
2024-10-14 15:20:36 +00:00
|
|
|
set menu_color_normal="white/black"
|
|
|
|
set menu_color_highlight="black/light-gray"
|
2024-10-06 19:47:09 +00:00
|
|
|
}
|
|
|
|
|
2024-10-14 17:56:41 +00:00
|
|
|
source (${root})/boot/grub/themes/theme.cfg
|
|
|
|
|
|
|
|
loadtheme ${default_theme}
|
2024-10-06 19:47:09 +00:00
|
|
|
|
|
|
|
if [ "${recordfail}" = 1 ] ; then
|
|
|
|
set timeout=30
|
|
|
|
else
|
|
|
|
if [ x$feature_timeout_style = xy ] ; then
|
|
|
|
set timeout_style=menu
|
|
|
|
set timeout=10
|
|
|
|
else
|
|
|
|
set timeout=10
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2024-10-14 15:20:36 +00:00
|
|
|
if [ "${grub_platform}" = "efi" ] ; then
|
2024-10-06 19:47:09 +00:00
|
|
|
rmmod tpm
|
|
|
|
fi
|
|
|
|
|
2024-10-14 15:20:36 +00:00
|
|
|
for cfg in (${root})/boot/grub/menuentries/*.cfg ; do
|
2024-10-06 19:47:09 +00:00
|
|
|
source $cfg
|
|
|
|
done
|
|
|
|
|
2024-10-14 17:56:41 +00:00
|
|
|
menuentry 'Reboot' --class restart {
|
2024-10-06 19:47:09 +00:00
|
|
|
reboot
|
|
|
|
}
|
|
|
|
|
2024-10-14 17:56:41 +00:00
|
|
|
menuentry 'Shutdown' --class shutdown {
|
2024-10-06 19:47:09 +00:00
|
|
|
halt
|
|
|
|
}
|