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 { function grub_list_const {
echo -n "\ target="${1}"
cpu-platform | ${grub_cpu}-${grub_platform} setparams \
cmdpath | ${cmdpath} " 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 { function grub_list_info {
@ -57,20 +66,38 @@ function grub_list_info {
} }
function grub_list_vars { function grub_list_vars {
echo -n "\ target="${1}"
root | ${root} setparams \
prefix | ${prefix} " root | ${root}" \
check_signatures | ${check_signatures} " 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 list_trusted
} }
function grub_list_xtra { function grub_list_xtra {
echo -n "\ target="${1}"
env | ${env} setparams \
live | ${live} " env | ${env}" \
data | ${data} " 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 { function grub_main {
@ -107,9 +134,14 @@ function grub_pause {
} }
function grub_split { function grub_split {
echo -n "\ target="${1}"
--- setparams \
" ' ---'
if [ "${target}" == 'menu' ] ; then
menuentry "${1}" { nop }
else
echo "${1}"
fi
} }
grub_main grub_main

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,17 +1,18 @@
env_init
menu_init menu_init
default='split' default='split'
menuentry "cmdpath: ${cmdpath}" { nop } grub_list_const 'menu'
menuentry "grub_cpu: ${grub_cpu} → grub_platform: ${grub_platform}" { nop } grub_split 'menu'
menu_split grub_list_vars 'menu'
menuentry "check_signatures: ${check_signatures} → pager: ${pager}" { nop } grub_split 'menu'
menuentry "prefix: ${prefix} → root: ${root}" { nop } grub_list_xtra 'menu'
menu_split 'split' 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 "check_squashfs | ${check_squashfs}" 'check_squashfs' 'enforce' 'no'
menu_swap " live_from | ${live_from}" 'live_from' 'ram' 'media' menu_swap " live_from | ${live_from}" 'live_from' 'ram' 'media'
menuentry " pause | ${pause}" { menu 'pause' } 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 { function menu_init {
env_init
if [ "${menu}" ] ; then if [ "${menu}" ] ; then
if [ "${1}" ] ; then if [ "${1}" ] ; then
menuentry "${menu}${1}" { nop } menuentry "${menu}${1}" { nop }

View file

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

View file

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