diff --git a/live/main.sh b/live/main.sh index d107b35..e8909da 100644 --- a/live/main.sh +++ b/live/main.sh @@ -9,10 +9,6 @@ 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 '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/pause.sh b/live/menu/pause.sh index debd3a2..f6a23df 100644 --- a/live/menu/pause.sh +++ b/live/menu/pause.sh @@ -1,6 +1,18 @@ menu_init -menu_item \ -60 \ -600 \ -999 +menu_item 0 ' 0' +menu_item 5 ' 5 seconds' +menu_item 9 ' 9 seconds ← 9 seconds' +menu_item 10 ' 10 seconds' +menu_split +menu_item 60 ' 1 minute' +menu_item 99 ' 1 minute 39 seconds ← 99 seconds' +menu_item 600 ' 10 minutes' +menu_item 900 ' 15 minutes' +menu_item 999 ' 16 minutes 39 seconds ← 999 seconds' +menu_split +menu_item 3600 ' 1 hour' +menu_item 9999 ' 2 hours 46 minutes 39 seconds ← 9999 seconds' +menu_split +menu_item 86400 '1 day' +menu_item 99999 '1 day 3 hours 46 minutes 39 seconds ← 99999 seconds' diff --git a/live/menu/set.sh b/live/menu/set.sh index 331de3b..603ff36 100644 --- a/live/menu/set.sh +++ b/live/menu/set.sh @@ -12,5 +12,6 @@ menuentry "esp: ${esp} → data: ${data}" { nop } 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' } +menu_swap "check_squashfs | ${check_squashfs}" 'check_squashfs' 'enforce' 'no' +menu_swap " live_from | ${live_from}" 'live_from' 'ram' 'media' +menuentry " pause | ${pause}" { menu 'pause' } diff --git a/live/source/env.sh b/live/source/env.sh index 05d29df..508fcef 100644 --- a/live/source/env.sh +++ b/live/source/env.sh @@ -31,11 +31,13 @@ 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_get { + unset get + if [ "${1}" == 'check_squashfs' ] ; then get="${check_squashfs}" ; fi + if [ "${1}" == 'live_from' ] ; then get="${live_from}" ; fi + if [ "${1}" == 'pause' ] ; then get="${pause}" ; fi + if [ "${1}" == 'time_out' ] ; then get="${time_out}" ; fi + if [ ! "${get}" ] ; then return 1 ; fi } function env_init { diff --git a/live/source/menu.sh b/live/source/menu.sh index 85dedc7..cc8ebfc 100644 --- a/live/source/menu.sh +++ b/live/source/menu.sh @@ -8,11 +8,20 @@ function menu { } function menu_color { - menu_item \ + setparams \ 'black' 'blue' 'green' 'cyan' \ 'red' 'magenta' 'brown' 'light-gray' \ 'dark-gray' 'light-blue' 'light-green' 'light-cyan' \ 'light-red' 'light-magenta' 'yellow' 'white' + for color in "${@}" ; do + menu_item "${color}" + done + unset color +} + +function menu_exit { + env save + menu } function menu_init { @@ -25,19 +34,26 @@ function menu_init { fi menu_split default=2 + if env_get "${menu}" ; then + default="_${get}" + unset get + fi fi } function menu_item { - env_default "${menu}" - for item in "${@}" ; do - menuentry "${item}" "${menu}" --id "_${item}" { - ${2}="${1}" - env save - menu + if [ "${1}" ] ; then + if [ "${2}" ] ; then + entry="${2}" + else + entry="${1}" + fi + menuentry "${entry}" "${1}" "${menu}" --id "_${1}" { + ${3}="${2}" + menu_exit } - done - unset item + unset entry + fi } function menu_load { @@ -53,3 +69,19 @@ function menu_split { menuentry '' { nop } fi } + +function menu_swap { + if [ "${4}" ] ; then + menuentry "${1}" "${2}" "${3}" "${4}" { + if env_get "${2}" ; then + if [ "${get}" == "${3}" ] ; then + ${2}="${4}" + else + ${2}="${3}" + fi + unset get + menu_exit + fi + } + fi +}