656 lines
18 KiB
INI
Executable file
656 lines
18 KiB
INI
Executable file
insmod font
|
|
insmod keylayouts
|
|
insmod part_msdos
|
|
insmod part_gpt
|
|
|
|
export loaded
|
|
export koptsok
|
|
export disable_gfxterm
|
|
export bootarch
|
|
export firmware
|
|
export firmware_found
|
|
export from
|
|
export fromiso
|
|
export bootlang
|
|
export keyboard
|
|
export timezone
|
|
export hwclock
|
|
export installermode
|
|
export desktop
|
|
export disktoram
|
|
export def_bootlang
|
|
export def_keyboard
|
|
export def_timezone
|
|
export def_netinstall
|
|
export def_autostartdesktop
|
|
export def_copytoram
|
|
export menu_color_normal
|
|
export menu_color_highlight
|
|
export pager
|
|
|
|
function menu_help {
|
|
check_help
|
|
grub_help
|
|
}
|
|
|
|
function check_help {
|
|
if [ -z "${koptsok}" ]; then
|
|
echo $"WARNING: nothing set"
|
|
echo $" System will use defaults"
|
|
echo " American English utc clock us "$"keyboard"
|
|
echo ""
|
|
fi
|
|
}
|
|
|
|
function kopts_help {
|
|
echo $"Example boot command line arguments:"
|
|
echo $" Setup"
|
|
echo " lang=<language>_<variant> keytable=<layout> tz=<region>/<city>"
|
|
echo " hostname=<name> username=<name>"
|
|
echo $" Kernel"
|
|
echo " blacklist=<module>"
|
|
echo $" Video"
|
|
echo " <module>.modeset=0"
|
|
echo " radeon.modeset=0 nouveau.modeset=0 i915.modeset=0"
|
|
echo " video=VGA-1:1920x1080e DVI-0:800x600"
|
|
echo ""
|
|
}
|
|
|
|
function grub_help {
|
|
echo $"To use the menu:"
|
|
echo $" press up or down to move between items"
|
|
echo $" press enter or right to select the item"
|
|
echo $" press e to edit the current item"
|
|
echo $" press c to go to the grub command line"
|
|
echo ""
|
|
echo $"Simply edit the first line of most menus to control them"
|
|
echo $"Select or edit the blank line to enter command line arguments"
|
|
echo ""
|
|
}
|
|
|
|
function menu_reload {
|
|
configfile /boot/grub/grub.cfg
|
|
}
|
|
|
|
function menu_continue {
|
|
echo -n $"Press Enter to continue"
|
|
read mcont
|
|
}
|
|
|
|
function prompt {
|
|
echo -n "> "
|
|
}
|
|
|
|
function is_efi {
|
|
if [ "${grub_platform}" = "efi" ]; then
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
function efi_detect {
|
|
if is_efi ; then
|
|
submenu --class=find.efi --hotkey=f "Detect EFI bootloaders" {
|
|
efi_found=false
|
|
|
|
for efi in (*,gpt*)/efi/*/*.efi (*,gpt*)/efi/*/*/*.efi (*,gpt*)/*.efi (*,gpt*)/*/*.efi ; do
|
|
regexp --set=1:efi_device '^\((.*)\)/' "${efi}"
|
|
if [ -e "${efi}" ]; then
|
|
efi_found=true
|
|
|
|
menuentry --class=efi "${efi}" "${efi_device}" {
|
|
root="${2}"
|
|
chainloader "${1}"
|
|
}
|
|
fi
|
|
done
|
|
|
|
if [ "${efi_found}" != true ]; then
|
|
menuentry --hotkey=q --class=find.none "No EFI files detected." {menu_reload}
|
|
else
|
|
menuentry --hotkey=q --class=cancel "Cancel" {menu_reload}
|
|
fi
|
|
}
|
|
fi
|
|
}
|
|
|
|
function memtest_detect {
|
|
if ! is_efi; then
|
|
if [ -f /boot/memtest ]; then
|
|
menuentry --class=memtest --hotkey=m "memtest" {linux16 /boot/$1}
|
|
fi
|
|
fi
|
|
}
|
|
|
|
function lang_setup {
|
|
source /boot/grub/locales/${1}
|
|
menu_reload
|
|
}
|
|
|
|
function lang_menu {
|
|
menuentry --class=lang.${ll} "lang=${ll}" "${ll}" {lang_setup "${2}"}
|
|
}
|
|
|
|
function installer_menu {
|
|
for opt in yes no; do
|
|
menuentry "${opt}" "${opt}" {
|
|
def_netinstall="${2}"
|
|
installermode="netinstall=${def_netinstall}"
|
|
menu_reload
|
|
}
|
|
done
|
|
}
|
|
|
|
function show_installermode {
|
|
submenu --class=netinstall --hotkey=m "netinstall=${def_netinstall}" {# set netinstall option above with the editor
|
|
if [ -n "$1" ]; then
|
|
if [ "$1" = "netinstall=${def_netinstall}" ]; then
|
|
default=0
|
|
menuentry --class=cancel --hotkey=q "Cancel (${def_netinstall})" {menu_reload}
|
|
installer_menu
|
|
else
|
|
regexp -s newinstallermode '^netinstall=(.*)' "$1"
|
|
if [ -z "${newinstallermode}" ]; then
|
|
def_netinstall="$1"
|
|
else
|
|
def_netinstall="${newinstallermode}"
|
|
fi
|
|
newinstallermode="netinstall=${def_netinstall}"
|
|
menu_reload
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
function show_timezones {
|
|
submenu --class=tz --hotkey=t "tz=${def_timezone}" {# set the timezone above with the editor
|
|
if [ -n "$1" ];then
|
|
if [ "$1" = "tz=${def_timezone}" ]; then
|
|
default=0
|
|
menuentry --class=cancel --hotkey=q "Cancel (${def_timezone})" {menu_reload}
|
|
for tt in Africa America Asia Atlantic Australia Etc Europe Pacific; do
|
|
submenu --class=tz.${tt} "${tt}" {
|
|
menuentry --class=cancel --hotkey=q "Cancel (${def_timezone})" {menu_reload}
|
|
source "/boot/grub/tz/${1}"
|
|
}
|
|
done
|
|
else
|
|
regexp -s newtz '^tz=(.*)' "$1"
|
|
if [ -z "$newtz" ]; then
|
|
def_timezone="$1"
|
|
else
|
|
def_timezone="$newtz"
|
|
fi
|
|
timezone="tz=$def_timezone"
|
|
menu_reload
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
function show_keymaps {
|
|
submenu --class=kbd --hotkey=k "keytable=${def_keyboard}" {# set the timezone above with the editor
|
|
if [ -n "$1" ]; then
|
|
if [ "$1" = "keytable=${def_keyboard}" ]; then
|
|
default=0
|
|
menuentry --class=cancel --hotkey=q "Cancel (${def_keyboard})" {menu_reload}
|
|
source /boot/grub/locales/keyboards
|
|
else
|
|
regexp -s newkey '^keytable=(.*)' "$1"
|
|
if [ -z "$newkey" ]; then
|
|
def_keyboard="$1"
|
|
else
|
|
def_keyboard="$newkey"
|
|
fi
|
|
keyboard="keytable=$def_keyboard"
|
|
menu_reload
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
function enviroments_menu {
|
|
|
|
for opt in gnome gnomexorg gnomeclassic cinnamon i3 i3withshmlog kde plasma lxde lxqt mate xfce4 openbox openboxkdesession sway weston cli; do
|
|
menuentry "desktop=${opt}" "${opt}" {
|
|
def_autostartdesktop="${2}"
|
|
desktop="autostartdesktop=${def_autostartdesktop}"
|
|
menu_reload
|
|
}
|
|
done
|
|
|
|
}
|
|
|
|
function show_enviroments {
|
|
submenu --class=desktop --hotkey=d "desktop=${def_autostartdesktop}" {
|
|
if [ -n "$1" ]; then
|
|
if [ "$1" = "desktop=${def_autostartdesktop}" ]; then
|
|
default=0
|
|
menuentry --class=cancel --hotkey=q "Cancel (${def_autostartdesktop})" {menu_reload}
|
|
enviroments_menu
|
|
else
|
|
regexp -s newenviromentsmode '^autostartdesktop=(.*)' "$1"
|
|
if [ -z "${newenviromentsmode}" ]; then
|
|
def_autostartdesktop="$1"
|
|
else
|
|
def_autostartdesktop="${newenviromentsmode}"
|
|
fi
|
|
newenviromentsmode="desktop=${def_autostartdesktop}"
|
|
menu_reload
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
function copytoram_menu {
|
|
|
|
for opt in y n; do
|
|
menuentry "copytoram=${opt}" "${opt}" {
|
|
def_copytoram="${2}"
|
|
disktoram="copytoram=${def_copytoram}"
|
|
menu_reload
|
|
}
|
|
done
|
|
|
|
}
|
|
|
|
function show_copytoram {
|
|
submenu --class=disktoram --hotkey=c "disktoram=${def_copytoram}" {
|
|
if [ -n "$1" ]; then
|
|
if [ "$1" = "disktoram=${def_copytoram}" ]; then
|
|
default=0
|
|
menuentry --class=cancel --hotkey=q "Cancel (${def_copytoram})" {menu_reload}
|
|
copytoram_menu
|
|
else
|
|
regexp -s newcopytorammode '^copytoram=(.*)' "$1"
|
|
if [ -z "${newcopytorammode}" ]; then
|
|
def_copytoram="$1"
|
|
else
|
|
def_copytoram="${newcopytorammode}"
|
|
fi
|
|
newcopytorammode="copytoram=${def_copytoram}"
|
|
menu_reload
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
function show_languages {
|
|
submenu --hotkey=l --class=lang "lang=${def_bootlang}" {# set the timezone above with the editor
|
|
if [ -n "$1" ]; then
|
|
if [ "$1" = "lang=${def_bootlang}" ]; then
|
|
default=0
|
|
menuentry --class=lang.${def_bootlang} "lang=${def_bootlang}" {menu_reload}
|
|
menuentry --class=lang.cs "Čeština" {lang_setup "cs_CZ"}
|
|
menuentry --class=lang.da "Dansk" {lang_setup "da_DK"}
|
|
submenu --class=lang.de "Deutsch" {
|
|
for ll in de_DE de_AT de_BE de_CH de_LI de_LU; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
submenu --class=lang.el "Ελληνικά" {
|
|
for ll in el_GR el_CY; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
submenu --class=lang.en "English" {
|
|
for ll in en_US en_AG en_AU en_BW en_CA en_DK en_GB en_HK en_IE en_IN en_NG en_NZ en_PH en_SG en_ZA en_ZW; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
submenu --class=lang.es "Español" {
|
|
for ll in es_ES es_AR es_BO es_CL es_CO es_CR es_DO es_EC es_GT es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY es_VE; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
submenu --class=lang.fr "Français" {
|
|
for ll in fr_FR fr_BE fr_CA fr_CH fr_LU fr_NC; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
submenu --class=lang.it "Italiano" {
|
|
for ll in it_IT it_CH; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
menuentry --class=lang.ja "日本語" {lang_setup "ja_JP"}
|
|
submenu --class=lang.nl "Nederlands" {
|
|
for ll in nl_NL nl_AW nl_BE; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
menuentry --class=lang.pl "Polski" {lang_setup "pl_PL"}
|
|
submenu --class=lang.pt "Português" {
|
|
for ll in pt_BR pt_PT; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
menuentry --class=lang.ro "Română" {lang_setup "ro_RO"}
|
|
submenu --class=lang.ru "Русский" {
|
|
for ll in ru_RU ru_UA;do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
submenu --class=lang.zh "中文" {
|
|
for ll in zh_CN zh_TW; do
|
|
lang_menu ${ll}
|
|
done
|
|
}
|
|
else
|
|
regexp -s newlang '^lang=(.*)' "$1"
|
|
if [ -z "$newlang" ]; then
|
|
def_bootlang="$1"
|
|
else
|
|
def_bootlang="$newlang"
|
|
fi
|
|
bootlang="lang=$def_bootlang"
|
|
if [ -f /boot/grub/locales/${def_bootlang} ]; then
|
|
source /boot/grub/locales/${def_bootlang}
|
|
fi
|
|
menu_reload
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
function boot_menu {
|
|
if [ "${hwclock}" = "utc=yes" ]; then
|
|
class="utc"
|
|
title="utc"
|
|
clockset=""
|
|
elif [ "${timezone}${bootlang}" = "" ]; then
|
|
class="unset"
|
|
title="utc"
|
|
clockset=""
|
|
else
|
|
title="${def_timezone}"
|
|
class="tz.${def_timezone}"
|
|
clockset="utc=yes"
|
|
fi
|
|
min2d="$MINUTE"
|
|
if regexp '(^.$)' "$min2d"; then
|
|
min2d="0${min2d}"
|
|
fi
|
|
hour2d="$HOUR"
|
|
if regexp '(^.$)' "$hour2d"; then
|
|
hour2d="0${hour2d}"
|
|
fi
|
|
menuentry --class=tz.$class --hotkey=u "$hour2d:$min2d $title" "$clockset" {
|
|
hwclock="$2"
|
|
menu_reload
|
|
}
|
|
show_timezones
|
|
show_keymaps
|
|
show_enviroments
|
|
show_copytoram
|
|
show_languages
|
|
show_installermode
|
|
default=5
|
|
}
|
|
|
|
function boot_defaults {
|
|
source /boot/grub/defaults.cfg
|
|
}
|
|
|
|
function grub_reboot {
|
|
menuentry " " {true}
|
|
menuentry --class=reboot "Reboot!" {reboot}
|
|
}
|
|
|
|
function grub_bios_installed {
|
|
if ! is_efi; then
|
|
menuentry "" {true}
|
|
menuentry --class=artix "Installed BIOS-System on $installed" {exit}
|
|
fi
|
|
}
|
|
|
|
function grub_efi_installed {
|
|
if is_efi; then
|
|
menu "" {true}
|
|
menu --class=artix "Installed EFI-System on $installed" {exit}
|
|
fi
|
|
}
|
|
|
|
|
|
function check {
|
|
cliname="$1"
|
|
varname="$2"
|
|
if [ "${optname}" != "${cliname}" ]; then
|
|
return 1
|
|
fi
|
|
if [ -z "$varname" ]; then
|
|
varname="${cliname}"
|
|
fi
|
|
if [ -z "${optval}" ]; then
|
|
eval ${varname}="${cliname}"
|
|
else
|
|
eval ${varname}="${cliname}=${optval}"
|
|
if [ "${optname}" = "lang" ]; then
|
|
lang_setup ${optval}
|
|
elif [ "${optname}" = "keytable" ]; then
|
|
def_keyboard="${optval}"
|
|
elif [ "${optname}" = "tz" ]; then
|
|
def_timezone="${optval}"
|
|
elif [ "${optname}" = "netinstall" ]; then
|
|
def_netinstall="${optval}"
|
|
elif [ "${optname}" = "autostartdesktop" ]; then
|
|
def_autostartdesktop="${optval}"
|
|
elif [ "${optname}" = "copytoram" ]; then
|
|
def_copytoram="${optval}"
|
|
fi
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
function checkinput {
|
|
newinput="$1"
|
|
newoutput=""
|
|
for newcli in ${newinput} ; do
|
|
optname=""
|
|
optval=""
|
|
optdone=""
|
|
regexp -s optname '^(.+)=.*$' "${newcli}"
|
|
if [ -z "${optname}" ]; then
|
|
optname="${newcli}"
|
|
else
|
|
regexp -s optval '^.+=(.*)$' "${newcli}"
|
|
fi
|
|
for tocheck in "lang bootlang" "keytable keyboard" "tz timezone" "utc hwclock" "installermode netinstall" "desktop autostartdesktop" "disktoram copytoram"; do
|
|
if check $tocheck ; then
|
|
optdone="Y"
|
|
break
|
|
fi
|
|
done
|
|
if [ -z "${optdone}" ]; then
|
|
if [ -z "${newoutput}" ]; then
|
|
newoutput="${newcli}"
|
|
else
|
|
newoutput="${newoutput} ${newcli}"
|
|
fi
|
|
fi
|
|
done
|
|
}
|
|
|
|
function new2cli {
|
|
newinput="$1"
|
|
if [ -n "$newinput" ]; then
|
|
checkinput "$newinput"
|
|
if [ -n "${newoutput}" ]; then
|
|
newinput="${newoutput}"
|
|
if [ -n "$clinput" ]; then
|
|
clinput="$clinput $newinput"
|
|
else
|
|
clinput="$newinput"
|
|
fi
|
|
export clinput
|
|
fi
|
|
fi
|
|
}
|
|
|
|
function getargs {
|
|
args=""
|
|
for a in $@; do
|
|
if [ -n "${a}" ]; then
|
|
args="${args} ${a}"
|
|
fi
|
|
done
|
|
}
|
|
|
|
function bootcheck {
|
|
getargs
|
|
}
|
|
|
|
pager=1
|
|
|
|
insmod regexp
|
|
insmod datehook
|
|
if ! is_efi; then
|
|
insmod part_gpt
|
|
fi
|
|
|
|
if is_efi; then
|
|
insmod efi_gop
|
|
insmod efi_uga
|
|
fi
|
|
|
|
if [ -z "${loaded}" ]; then
|
|
iscd=""
|
|
auto=""
|
|
regexp -s iscd '^(cd)' "${root}"
|
|
if [ "${iscd}" != "cd" -a -e (cd) ]; then
|
|
probe -s cdp -u cd
|
|
probe -s hdp -u $root
|
|
if [ -n "$cdp" -a "$cdp" = "$hdp" ]; then
|
|
iscd="cd"
|
|
fi
|
|
fi
|
|
if [ "${root}" != "hd96" -a "${iscd}" != "cd" ]; then
|
|
auto="${auto}"
|
|
fi
|
|
source /boot/grub/variable.cfg
|
|
loaded=true
|
|
|
|
if keystatus --shift; then
|
|
disable_gfxterm=true
|
|
fi
|
|
|
|
if [ "${disable_gfxterm}" != "true" ]; then
|
|
if loadfont /boot/grub/unicode.pf2 ; then
|
|
if [ -z "$gfxmode" ] ; then
|
|
gfxmode=1920x1080,1280x1024,1024x768,800x600
|
|
gfxpayload=keep
|
|
fi
|
|
if keystatus --ctrl; then
|
|
gfxok=""
|
|
pager=0
|
|
while [ -z "$gfxok" ]; do
|
|
echo "gfxmode=$gfxmode"
|
|
echo "Input new mode or Enter to confirm"
|
|
prompt
|
|
read gfxmodein
|
|
if [ -n "$gfxmodein" ]; then
|
|
gfxmode="$gfxmodein"
|
|
echo ""
|
|
else
|
|
gfxok="true"
|
|
fi
|
|
done
|
|
fi
|
|
insmod all_video
|
|
insmod gfxterm
|
|
if terminal_output --append gfxterm; then
|
|
terminal_output --remove console
|
|
else
|
|
disable_gfxterm=true
|
|
fi
|
|
else
|
|
disable_gfxterm=true
|
|
fi
|
|
fi
|
|
|
|
if [ "${disable_gfxterm}" != "true" -a -f "${grub_theme}" ]; then
|
|
insmod gfxmenu
|
|
themedir=""
|
|
regexp -s themedir '^(.*)/.*$' "${grub_theme}"
|
|
for themefont in $themedir/*.pf2 $themedir/f/*.pf2; do
|
|
if [ -f "${themefont}" ]; then
|
|
loadfont "${themefont}"
|
|
fi
|
|
done
|
|
for imagetype in jpg jpeg png tga; do
|
|
for themeimage in ${themedir}/*.${imagetype}; do
|
|
if [ -f "${themeimage}" ]; then
|
|
if [ "${imagetype}" = "jpg" ]; then
|
|
insmod jpeg
|
|
else
|
|
insmod $imagetype
|
|
fi
|
|
fi
|
|
done
|
|
done
|
|
theme=${grub_theme}
|
|
export theme
|
|
fi
|
|
|
|
menu_color_normal=cyan/blue
|
|
menu_color_highlight=white/blue
|
|
|
|
if [ -n "${iso_path}" ]; then
|
|
auto="img_dev=/dev/disk/by-uuid/${rootuuid} img_loop=${iso_path}"
|
|
fi
|
|
|
|
export auto
|
|
fi
|
|
|
|
boot_defaults
|
|
|
|
for kopt in "${clinput}" "${bootlang}" "${keyboard}" "${timezone}" "${hwclock}" "${installermode}" "${desktop}" "${disktoram}" "${auto}"; do
|
|
if [ -n "${kopt}" ]; then
|
|
kopts="${kopts} ${kopt}"
|
|
fi
|
|
done
|
|
if [ -n "${bootlang}${keyboard}${timezone}${installermode}${desktop}${disktoram}" ]; then
|
|
koptsok="true"
|
|
fi
|
|
|
|
boot_menu
|
|
|
|
source /boot/grub/kernels.cfg
|
|
if [ -n "$clinput" ]; then
|
|
menuentry --class=edit "$clinput" {
|
|
if [ -n "$1" ]; then
|
|
clinput="$@"
|
|
else
|
|
unset clinput
|
|
fi
|
|
menu_reload
|
|
}
|
|
fi
|
|
menuentry --class=type --hotkey=tab "" {# set arguments above with the editor
|
|
getargs $@
|
|
pager=0
|
|
if [ -z "$args" ]; then
|
|
check_help
|
|
kopts_help
|
|
echo $"Input command line options, press Enter to continue"
|
|
prompt
|
|
read newinput
|
|
else
|
|
newinput="$args"
|
|
fi
|
|
new2cli "$newinput"
|
|
pager=1
|
|
menu_reload
|
|
}
|
|
menuentry --hotkey=h --class=help "help" {
|
|
pager=0
|
|
menu_help
|
|
menu_continue
|
|
pager=1
|
|
}
|
|
efi_detect
|
|
memtest_detect
|
|
search --no-floppy --file /etc/issue --set installed
|
|
grub_bios_installed
|
|
grub_efi_installed
|
|
grub_reboot
|