diff --git a/build.sh b/build.sh index 1433d54..9c267b8 100755 --- a/build.sh +++ b/build.sh @@ -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 ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ diff --git a/grub.cfg.sh b/grub.cfg.sh index ae0fb18..3db2e81 100644 --- a/grub.cfg.sh +++ b/grub.cfg.sh @@ -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 { diff --git a/live/configfile.sh b/live/configfile.sh new file mode 100644 index 0000000..0c91d68 --- /dev/null +++ b/live/configfile.sh @@ -0,0 +1 @@ +menuentry 'configfile' { nop } diff --git a/live/main.sh b/live/main.sh index bcad76e..d107b35 100644 --- a/live/main.sh +++ b/live/main.sh @@ -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' } diff --git a/live/menu/env.sh b/live/menu/env.sh index b538584..45cb61e 100644 --- a/live/menu/env.sh +++ b/live/menu/env.sh @@ -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 } diff --git a/live/menu/gfx.sh b/live/menu/gfx.sh index ac704fe..7c75aee 100644 --- a/live/menu/gfx.sh +++ b/live/menu/gfx.sh @@ -2,5 +2,5 @@ menu_init menuentry 'list' { videoinfo - pause + grub_pause } diff --git a/live/menu/pause.sh b/live/menu/pause.sh new file mode 100644 index 0000000..debd3a2 --- /dev/null +++ b/live/menu/pause.sh @@ -0,0 +1,6 @@ +menu_init + +menu_item \ +60 \ +600 \ +999 diff --git a/live/menu/set.sh b/live/menu/set.sh index 0fc6696..331de3b 100644 --- a/live/menu/set.sh +++ b/live/menu/set.sh @@ -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' } diff --git a/live/source/boot.sh b/live/source/boot.sh index 23dc67f..aef777b 100644 --- a/live/source/boot.sh +++ b/live/source/boot.sh @@ -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 \ diff --git a/live/source/env.sh b/live/source/env.sh index 66ade13..05d29df 100644 --- a/live/source/env.sh +++ b/live/source/env.sh @@ -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' -} diff --git a/live/source/menu.sh b/live/source/menu.sh index e106b1f..85dedc7 100644 --- a/live/source/menu.sh +++ b/live/source/menu.sh @@ -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 diff --git a/live/source/util.sh b/live/source/util.sh index b1d6ac9..f21985a 100644 --- a/live/source/util.sh +++ b/live/source/util.sh @@ -1,15 +1,3 @@ -function echo_eval { - if [ "${1}" ] ; then - echo "${@}" - eval "${@}" - fi -} - function nop { true } - -function pause { - echo -n 'Press Enter: ' - read -} diff --git a/readme.md b/readme.md index 39c64e9..5a3c114 100644 --- a/readme.md +++ b/readme.md @@ -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