diff --git a/build.sh b/build.sh index fb57ff9..99b0796 100644 --- a/build.sh +++ b/build.sh @@ -79,15 +79,14 @@ function var_set { # env=\"(\${esp})/grub.env\" live=\"(\${esp})/${PROJECT}/live\" - menus=\"\${live}/menu\" # - for file in \${live}/*.sh ; do + for file in \${live}/source/*.sh ; do source \"\${file}\" done unset file # env_init - normal \"\${menus}/main.sh\" + normal \"\${live}/main.sh\" fi } diff --git a/live/main.sh b/live/main.sh index 7a2230d..7a38f69 100644 --- a/live/main.sh +++ b/live/main.sh @@ -1,25 +1,11 @@ -function debsquash { - boot_toram='true' - lmp="${1}" - sfs="filesystem.squashfs" - if [ -f "(${data})${lmp}/vmlinuz" ]; then - linux_path="(${data})${lmp}/vmlinuz" - initrd_path="(${data})${lmp}/initrd.img" - else - linux_path="(squash)/vmlinuz" - initrd_path="(squash)/initrd.img" - loopback "squash" "${lmp}/${sfs}" - fi - boot_linux="linux \ -\"${linux_path}\" \ -boot=\"live\" \ -elevator=\"deadline\" \ -ip=\"frommedia\" \ -live-media-path=\"${lmp}\" \ -toram" - if [ "${boot_toram}" == "true" ]; then - boot_linux="${boot_linux}=\"${sfs}\"" - fi - echo_eval "${boot_linux}" - initrd "${initrd_path}" -} +menuentry 'scan →' { menu 'scan' } +menuentry 'var →' { menu 'var' } +menu_split +menuentry 'data / boot / bash / latest / gui' { debsquash '/boot/bash/latest/gui' } +menuentry 'data / boot / bash / latest / tui' { debsquash '/boot/bash/latest/tui' } +menuentry 'data / boot / bash / stable / gui' { debsquash '/boot/bash/stable/gui' } +menuentry 'data / boot / bash / stable / tui' { debsquash '/boot/bash/stable/tui' } +menu_split +menuentry "cmd → ${cmdpath} → ${grub_cpu}-${grub_platform}" { menu 'cmd' } +menuentry "env → ${env} → ${env_mod}" { menu 'env' } +menuentry 'gfx → ?' { menu 'gfx' } diff --git a/live/menu/main.sh b/live/menu/main.sh deleted file mode 100644 index 067e2d3..0000000 --- a/live/menu/main.sh +++ /dev/null @@ -1,13 +0,0 @@ -menuentry 'nav →' { menu 'nav' } -menu_split -menuentry 'data / boot / bash / latest / gui' { debsquash '/boot/bash/latest/gui' } -menuentry 'data / boot / bash / latest / tui' { debsquash '/boot/bash/latest/tui' } -menuentry 'data / boot / bash / stable / gui' { debsquash '/boot/bash/stable/gui' } -menuentry 'data / boot / bash / stable / tui' { debsquash '/boot/bash/stable/tui' } -menu_split -menuentry "cmd → ${cmdpath} → ${grub_cpu}-${grub_platform}" { menu 'cmd' } -menuentry "env → ${env} → ${env_mod}" { menu 'env' } -menuentry 'gfx → ?' { menu 'gfx' } -menuentry 'ovl → ?' { nop } -menu_split -scan diff --git a/live/menu/nav.sh b/live/menu/nav.sh deleted file mode 100644 index 0855a2c..0000000 --- a/live/menu/nav.sh +++ /dev/null @@ -1,3 +0,0 @@ -menu_init "${nav}" - -nav "${nav}" diff --git a/live/menu/scan.sh b/live/menu/scan.sh new file mode 100644 index 0000000..a05e604 --- /dev/null +++ b/live/menu/scan.sh @@ -0,0 +1,3 @@ +menu_init "${scan}" + +scan "${scan}" diff --git a/live/menu/var.sh b/live/menu/var.sh new file mode 100644 index 0000000..eccc39c --- /dev/null +++ b/live/menu/var.sh @@ -0,0 +1,12 @@ +menu_init +default='split' +menuentry "check_signatures | ${check_signatures}" { nop } +menuentry "pager | ${pager}" { nop } +menuentry "prefix | ${prefix}" { nop } +menuentry "root | ${root}" { nop } +menu_split 'split' +menuentry "data | ${data}" { nop } +menuentry "esp | ${esp}" { nop } +menuentry "env | ${env}" { nop } +menuentry "env_mod | ${env_mod}" { nop } +menuentry "live | ${live}" { nop } diff --git a/live/scan.sh b/live/scan.sh deleted file mode 100644 index 314dc8b..0000000 --- a/live/scan.sh +++ /dev/null @@ -1,3 +0,0 @@ -function scan { - menuentry 'scan' { nop } -} diff --git a/live/source/boot.sh b/live/source/boot.sh new file mode 100644 index 0000000..7a2230d --- /dev/null +++ b/live/source/boot.sh @@ -0,0 +1,25 @@ +function debsquash { + boot_toram='true' + lmp="${1}" + sfs="filesystem.squashfs" + if [ -f "(${data})${lmp}/vmlinuz" ]; then + linux_path="(${data})${lmp}/vmlinuz" + initrd_path="(${data})${lmp}/initrd.img" + else + linux_path="(squash)/vmlinuz" + initrd_path="(squash)/initrd.img" + loopback "squash" "${lmp}/${sfs}" + fi + boot_linux="linux \ +\"${linux_path}\" \ +boot=\"live\" \ +elevator=\"deadline\" \ +ip=\"frommedia\" \ +live-media-path=\"${lmp}\" \ +toram" + if [ "${boot_toram}" == "true" ]; then + boot_linux="${boot_linux}=\"${sfs}\"" + fi + echo_eval "${boot_linux}" + initrd "${initrd_path}" +} diff --git a/live/env.sh b/live/source/env.sh similarity index 100% rename from live/env.sh rename to live/source/env.sh diff --git a/live/menu.sh b/live/source/menu.sh similarity index 77% rename from live/menu.sh rename to live/source/menu.sh index 0c9a37c..9a7a812 100644 --- a/live/menu.sh +++ b/live/source/menu.sh @@ -1,8 +1,9 @@ function menu { if [ "${1}" ] ; then - menu_load "${1}" "${menus}/${1}.sh" + menu_load "${1}" else - menu_load 'main' "${menus}/main.sh" + export "${menu}" + menu_load "${menu}" fi } @@ -37,12 +38,16 @@ function menu_item { function menu_load { menu="${1}" - export menu nav + export menu # env_export var_export - configfile "${2}" + configfile "${live}/menu/${menu}.sh" } function menu_split { - menuentry '' { nop } + if [ "${1}" ] ; then + menuentry '' --id "${1}" { nop } + else + menuentry '' { nop } + fi } diff --git a/live/probe.sh b/live/source/probe.sh similarity index 100% rename from live/probe.sh rename to live/source/probe.sh diff --git a/live/nav.sh b/live/source/scan.sh similarity index 95% rename from live/nav.sh rename to live/source/scan.sh index c30ca2a..f92fd83 100644 --- a/live/nav.sh +++ b/live/source/scan.sh @@ -1,4 +1,4 @@ -function nav { +function scan { if [ "${1}" ] ; then paths="${1}/*" else @@ -20,8 +20,8 @@ function nav { if [ "${tmp}" != '*' ] ; then if [ -d "${path}" ] ; then menuentry "${tmp} →" "${path}" --id "${path}" { - nav="${2}" - menu "${menu}" + scan="${2}" + menu } else menuentry "${tmp}" { diff --git a/live/util.sh b/live/source/util.sh similarity index 100% rename from live/util.sh rename to live/source/util.sh diff --git a/live/source/var.sh b/live/source/var.sh new file mode 100644 index 0000000..ed44966 --- /dev/null +++ b/live/source/var.sh @@ -0,0 +1,6 @@ +function var_export { + export \ + data esp \ + env env_mod \ + live +} diff --git a/live/var.sh b/live/var.sh deleted file mode 100644 index 1591665..0000000 --- a/live/var.sh +++ /dev/null @@ -1,26 +0,0 @@ -function var_echo { - echo "check_signatures: ${check_signatures} | pager: ${pager}" - echo "prefix: ${prefix} | root: ${root}" - echo - echo "data: ${data} | esp: ${esp}" - echo "env: ${env} | env_mod: ${env_mod}" - echo "live: ${live} | menus: ${menus}" -} - -function var_export { - export \ - data esp \ - env env_mod \ - live menus -} - -function var_menu { - menuentry "check_signatures: ${check_signatures} | pager: ${pager}" { - nop - } - menuentry "prefix: ${prefix} | root: ${root}" { nop } - menu_split - menuentry "data: ${data} | esp: ${esp}" { nop } - menuentry "env: ${env} | env_mod: ${env_mod}" { nop } - menuentry "live: ${live} | menus: ${menus}" { nop } -}