env,pause

This commit is contained in:
Marc Beninca 2023-11-22 22:56:22 +01:00
parent 2ab2f2032e
commit 738c2095d2
13 changed files with 52 additions and 41 deletions

View file

@ -256,13 +256,13 @@ echo -n "
write_env "${GRUBENV}" "\ write_env "${GRUBENV}" "\
live_name=${PROJECT} live_name=${PROJECT}
data_uuid=${DATA} data_uuid=${DATA}
check_squashfs=enforce
live_from=ram
pause=999
time_out=10
" "
write_env "${GRUB_ENV}" "\ write_env "${GRUB_ENV}" "\
check_squashfs=enforce
grub_sleep=999
time_out=10
to_ram=enforce
" "
# grub / fonts ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ # grub / fonts ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅

View file

@ -25,7 +25,7 @@ function grub_init {
load_env \ load_env \
--skip-sig \ --skip-sig \
--file "${env}" \ --file "${env}" \
'grub_sleep' 'pause'
# #
live="(${esp})/boot/${live_name}" live="(${esp})/boot/${live_name}"
# #
@ -103,7 +103,7 @@ function grub_pause {
sleep \ sleep \
--interruptible \ --interruptible \
--verbose \ --verbose \
"${grub_sleep}" "${pause}"
} }
function grub_split { function grub_split {

1
live/configfile.sh Normal file
View file

@ -0,0 +1 @@
menuentry 'configfile' { nop }

View file

@ -8,10 +8,11 @@ menuentry '↑ env →' { menu 'env' }
menuentry '↑ set →' { menu 'set' } menuentry '↑ set →' { menu 'set' }
menuentry '↑ cmd →' { menu 'cmd' } menuentry '↑ cmd →' { menu 'cmd' }
menu_split menu_split
menuentry 'configfile' { configfile "${live}/configfile.sh" }
menuentry 'check_squashfs = enforce' { check_squashfs='enforce' } menuentry 'check_squashfs = enforce' { check_squashfs='enforce' }
menuentry 'check_squashfs = no' { check_squashfs='no' } menuentry 'check_squashfs = no' { check_squashfs='no' }
menuentry 'to_ram = enforce' { to_ram='enforce' } menuentry 'live_from = ram' { live_from='ram' }
menuentry 'to_ram = no' { to_ram='no' } menuentry 'live_from = media' { live_from='media' }
menu_split menu_split
menuentry 'bash / stable / tui' { debsquash '/boot/bash/stable/tui' } menuentry 'bash / stable / tui' { debsquash '/boot/bash/stable/tui' }
menuentry 'bash / stable / gui' { debsquash '/boot/bash/stable/gui' } menuentry 'bash / stable / gui' { debsquash '/boot/bash/stable/gui' }

View file

@ -2,14 +2,14 @@ menu_init "${env} → ${env_mod}"
menuentry 'list file' { menuentry 'list file' {
env_list env_list
pause grub_pause
} }
menuentry 'list variables' { menuentry 'list variables' {
set set
pause grub_pause
} }
menuentry 'reset defaults' { menuentry 'reset defaults' {
env_set env set
env save env save
env_apply env_apply
} }

View file

@ -2,5 +2,5 @@ menu_init
menuentry 'list' { menuentry 'list' {
videoinfo videoinfo
pause grub_pause
} }

6
live/menu/pause.sh Normal file
View file

@ -0,0 +1,6 @@
menu_init
menu_item \
60 \
600 \
999

View file

@ -13,3 +13,4 @@ menuentry "env: ${env} → env_mod: ${env_mod}" { nop }
menuentry "live: ${live}" { nop } menuentry "live: ${live}" { nop }
menu_split menu_split
menuentry "check_squashfs: ${check_squashfs}" { nop } menuentry "check_squashfs: ${check_squashfs}" { nop }
menuentry "pause: ${pause}" { menu 'pause' }

View file

@ -24,7 +24,7 @@ function debsquash {
echo 'linux' echo 'linux'
echo "${linux_path}" echo "${linux_path}"
toram='toram' toram='toram'
if [ "${to_ram}" == 'enforce' ] ; then if [ "${live_from}" == 'ram' ] ; then
toram="${toram}=${sfs}" toram="${toram}=${sfs}"
fi fi
linux \ linux \

View file

@ -1,16 +1,26 @@
function env { function env {
action="${1}" action="${1}"
setparams \ setparams \
'check_squashfs' 'grub_sleep' 'time_out' 'to_ram' 'check_squashfs' \
'live_from' \
'pause' \
'time_out'
if [ "${action}" == 'load' ] ; then if [ "${action}" == 'load' ] ; then
load_env \ load_env \
--file "${env}" \
--skip-sig \ --skip-sig \
--file "${env}" "${@}" "${@}"
fi fi
if [ "${action}" == 'save' ] ; then if [ "${action}" == 'save' ] ; then
save_env \ save_env \
--file "${env}" "${@}" --file "${env}" \
"${@}"
fi fi
if [ "${action}" == 'set' ] ; then
load_env \
"${@}"
fi
unset action
} }
function env_apply { function env_apply {
@ -21,10 +31,18 @@ function env_apply {
fi fi
} }
function env_default {
if [ "${1}" == 'check_squashfs' ] ; then default="_${check_squashfs}" ; fi
if [ "${1}" == 'live_from' ] ; then default="_${live_from}" ; fi
if [ "${1}" == 'pause' ] ; then default="_${pause}" ; fi
if [ "${1}" == 'time_out' ] ; then default="_${time_out}" ; fi
}
function env_init { function env_init {
grub_init grub_init
env_set env set
env_mod env_mod
env load
env_apply env_apply
} }
@ -46,10 +64,3 @@ function env_mod {
fi fi
fi fi
} }
function env_set {
check_squashfs='enforce'
grub_sleep=999
time_out=10
to_ram='enforce'
}

View file

@ -2,7 +2,7 @@ function menu {
if [ "${1}" ] ; then if [ "${1}" ] ; then
menu_load "${1}" menu_load "${1}"
else else
export "${menu}" export menu
menu_load "${menu}" menu_load "${menu}"
fi fi
} }
@ -29,10 +29,11 @@ function menu_init {
} }
function menu_item { function menu_item {
eval "default=\"id_\${${menu}}\"" env_default "${menu}"
for item in "${@}" ; do for item in "${@}" ; do
menuentry "${item}" "${menu}" --id "id_${item}" { menuentry "${item}" "${menu}" --id "_${item}" {
eval "${2}=\"${1}\"" ${2}="${1}"
env save
menu menu
} }
done done

View file

@ -1,15 +1,3 @@
function echo_eval {
if [ "${1}" ] ; then
echo "${@}"
eval "${@}"
fi
}
function nop { function nop {
true true
} }
function pause {
echo -n 'Press Enter: '
read
}

View file

@ -44,6 +44,7 @@ Build an ESP File System including:
│ │ ├── cmd.sh │ │ ├── cmd.sh
│ │ ├── env.sh │ │ ├── env.sh
│ │ ├── gfx.sh │ │ ├── gfx.sh
│ │ ├── pause.sh
│ │ ├── scan.sh │ │ ├── scan.sh
│ │ └── set.sh │ │ └── set.sh
│ └── source │ └── source
@ -116,6 +117,7 @@ build.sh pgp_fingerprint /esp/mount/point [/data/mount/point]
│ │ ├── cmd.sh │ │ ├── cmd.sh
│ │ ├── env.sh │ │ ├── env.sh
│ │ ├── gfx.sh │ │ ├── gfx.sh
│ │ ├── pause.sh
│ │ ├── scan.sh │ │ ├── scan.sh
│ │ └── set.sh │ │ └── set.sh
│ └── source │ └── source