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}" "\
live_name=${PROJECT}
data_uuid=${DATA}
check_squashfs=enforce
live_from=ram
pause=999
time_out=10
"
write_env "${GRUB_ENV}" "\
check_squashfs=enforce
grub_sleep=999
time_out=10
to_ram=enforce
"
# grub / fonts ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅

View file

@ -25,7 +25,7 @@ function grub_init {
load_env \
--skip-sig \
--file "${env}" \
'grub_sleep'
'pause'
#
live="(${esp})/boot/${live_name}"
#
@ -103,7 +103,7 @@ function grub_pause {
sleep \
--interruptible \
--verbose \
"${grub_sleep}"
"${pause}"
}
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 '↑ cmd →' { menu 'cmd' }
menu_split
menuentry 'configfile' { configfile "${live}/configfile.sh" }
menuentry 'check_squashfs = enforce' { check_squashfs='enforce' }
menuentry 'check_squashfs = no' { check_squashfs='no' }
menuentry 'to_ram = enforce' { to_ram='enforce' }
menuentry 'to_ram = no' { to_ram='no' }
menuentry 'live_from = ram' { live_from='ram' }
menuentry 'live_from = media' { live_from='media' }
menu_split
menuentry 'bash / stable / tui' { debsquash '/boot/bash/stable/tui' }
menuentry 'bash / stable / gui' { debsquash '/boot/bash/stable/gui' }

View file

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

View file

@ -2,5 +2,5 @@ menu_init
menuentry 'list' {
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 }
menu_split
menuentry "check_squashfs: ${check_squashfs}" { nop }
menuentry "pause: ${pause}" { menu 'pause' }

View file

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

View file

@ -1,16 +1,26 @@
function env {
action="${1}"
setparams \
'check_squashfs' 'grub_sleep' 'time_out' 'to_ram'
'check_squashfs' \
'live_from' \
'pause' \
'time_out'
if [ "${action}" == 'load' ] ; then
load_env \
--file "${env}" \
--skip-sig \
--file "${env}" "${@}"
"${@}"
fi
if [ "${action}" == 'save' ] ; then
save_env \
--file "${env}" "${@}"
--file "${env}" \
"${@}"
fi
if [ "${action}" == 'set' ] ; then
load_env \
"${@}"
fi
unset action
}
function env_apply {
@ -21,10 +31,18 @@ function env_apply {
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 {
grub_init
env_set
env set
env_mod
env load
env_apply
}
@ -46,10 +64,3 @@ function env_mod {
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
menu_load "${1}"
else
export "${menu}"
export menu
menu_load "${menu}"
fi
}
@ -29,10 +29,11 @@ function menu_init {
}
function menu_item {
eval "default=\"id_\${${menu}}\""
env_default "${menu}"
for item in "${@}" ; do
menuentry "${item}" "${menu}" --id "id_${item}" {
eval "${2}=\"${1}\""
menuentry "${item}" "${menu}" --id "_${item}" {
${2}="${1}"
env save
menu
}
done

View file

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

View file

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