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

@ -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}"
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
}