env_init, grub list & split

This commit is contained in:
Marc Beninca 2023-11-24 06:32:00 +01:00
parent 86d12fe01f
commit 99ae54c84c
11 changed files with 112 additions and 52 deletions

View file

@ -34,10 +34,19 @@ function grub_init {
}
function grub_list_const {
echo -n "\
cpu-platform | ${grub_cpu}-${grub_platform}
cmdpath | ${cmdpath}
"
target="${1}"
setparams \
" cpu-platform | ${grub_cpu}-${grub_platform}" \
" cmdpath | ${cmdpath}"
for entry in "${@}" ; do
if [ "${target}" == 'menu' ] ; then
menuentry "${entry}" { nop }
else
echo "${entry}"
fi
done
unset entry
unset target
}
function grub_list_info {
@ -57,20 +66,38 @@ function grub_list_info {
}
function grub_list_vars {
echo -n "\
root | ${root}
prefix | ${prefix}
check_signatures | ${check_signatures}
"
target="${1}"
setparams \
" root | ${root}" \
" prefix | ${prefix}" \
"check_signatures | ${check_signatures}"
for entry in "${@}" ; do
if [ "${target}" == 'menu' ] ; then
menuentry "${entry}" { nop }
else
echo "${entry}"
fi
done
unset entry
unset target
list_trusted
}
function grub_list_xtra {
echo -n "\
env | ${env}
live | ${live}
data | ${data}
"
target="${1}"
setparams \
" env | ${env}" \
" live | ${live}" \
" data | ${data}"
for entry in "${@}" ; do
if [ "${target}" == 'menu' ] ; then
menuentry "${entry}" { nop }
else
echo "${entry}"
fi
done
unset entry
unset target
}
function grub_main {
@ -107,9 +134,14 @@ function grub_pause {
}
function grub_split {
echo -n "\
---
"
target="${1}"
setparams \
' ---'
if [ "${target}" == 'menu' ] ; then
menuentry "${1}" { nop }
else
echo "${1}"
fi
}
grub_main

View file

@ -1,3 +1,4 @@
env_init
menu_init
default='scan'

View file

@ -1,3 +1,4 @@
env_init
menu_init
menuentry 'halt' { halt }

View file

@ -1,3 +1,4 @@
env_init
menu_init "${env}${env_mod}"
menuentry 'list file' {

View file

@ -1,3 +1,4 @@
env_init
menu_init
menuentry 'list' {

View file

@ -1,3 +1,4 @@
env_init
menu_init
menu_item 0 ' 0'

View file

@ -1,3 +1,4 @@
env_init
menu_init "${scan}"
scan "${scan}"

View file

@ -1,17 +1,18 @@
env_init
menu_init
default='split'
menuentry "cmdpath: ${cmdpath}" { nop }
menuentry "grub_cpu: ${grub_cpu} → grub_platform: ${grub_platform}" { nop }
menu_split
menuentry "check_signatures: ${check_signatures} → pager: ${pager}" { nop }
menuentry "prefix: ${prefix} → root: ${root}" { nop }
grub_list_const 'menu'
grub_split 'menu'
grub_list_vars 'menu'
grub_split 'menu'
grub_list_xtra 'menu'
menu_split 'split'
menuentry "esp: ${esp} → data: ${data}" { nop }
menuentry "env: ${env} → env_mod: ${env_mod}" { nop }
menuentry "live: ${live}" { nop }
menu_split
menu_swap "check_squashfs | ${check_squashfs}" 'check_squashfs' 'enforce' 'no'
menu_swap " live_from | ${live_from}" 'live_from' 'ram' 'media'
menuentry " pause | ${pause}" { menu 'pause' }
menu_split
menuentry "esp: ${esp}" { nop }
menuentry "env_mod: ${env_mod}" { nop }
menuentry "pager: ${pager}" { nop }

View file

@ -25,7 +25,6 @@ function menu_exit {
}
function menu_init {
env_init
if [ "${menu}" ] ; then
if [ "${1}" ] ; then
menuentry "${menu}${1}" { nop }

View file

@ -210,6 +210,8 @@ bash /media/ssd/esp/bios/setup.sh /dev/sda
* [ ] try -mount-opts
* refactor grub list_{const,vars,xtra} & split
### Python

View file

@ -43,7 +43,6 @@
* rmmod
* sha256sum
* sha512sum
* sleep
* background_color
* background_image
@ -54,7 +53,6 @@
* cryptomount
* date
* echo
* eval
* export
* halt
* initrd
@ -78,7 +76,6 @@
* normal
* normal_exit
* probe
* read
* reboot
* regexp
* save_env
@ -93,11 +90,49 @@
* trust
* unset
* verify_detached
### x86_64-efi-signed
#### allowed
* sleep
#### denied
* eval
* read
* videoinfo
## Variables
* biosnum
* icondir
* net_default_interface
* pxe_blksize
* pxe_default_gateway
* superusers
* config_directory
* config_file
* debug
* default
* fallback
* gfxmode
* gfxpayload
* gfxterm_font
* menu_color_highlight
* menu_color_normal
* theme
* timeout
* timeout_style
### Function
* ?
### Persistent
* feature_200_final
* feature_all_video_module
* feature_chainloader_bpb
@ -108,43 +143,28 @@
* feature_ntldr
* feature_platform_search_hint
* feature_timeout_style
* icondir
* net_default_interface
* net_default_ip
* net_default_mac
* net_default_server
* pxe_blksize
* pxe_default_gateway
* pxe_default_server
* superusers
* secondary_locale_dir
* chosen
* config_directory
* config_file
* ?
* check_signatures
* chosen
* cmdpath
* (hd?,*)/efi/boot/bootx64.efi
* (hd?)
* color_highlight
* color_normal
* debug
* default
* fallback
* gfxmode
* gfxpayload
* gfxterm_font
* grub_cpu
* grub_platform
* lang
* locale_dir
* menu_color_highlight
* menu_color_normal
* pager
* prefix
* root
* secondary_locale_dir
* theme
* timeout
* timeout_style
#### x86_64-efi-signed
* lockdown
* shim_lock