refactor
This commit is contained in:
parent
0dc8e3e6b1
commit
39e1a9b927
15 changed files with 72 additions and 81 deletions
5
build.sh
5
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
|
||||
}
|
||||
|
||||
|
|
36
live/main.sh
36
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' }
|
||||
|
|
|
@ -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
|
|
@ -1,3 +0,0 @@
|
|||
menu_init "${nav}"
|
||||
|
||||
nav "${nav}"
|
3
live/menu/scan.sh
Normal file
3
live/menu/scan.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
menu_init "${scan}"
|
||||
|
||||
scan "${scan}"
|
12
live/menu/var.sh
Normal file
12
live/menu/var.sh
Normal file
|
@ -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 }
|
|
@ -1,3 +0,0 @@
|
|||
function scan {
|
||||
menuentry 'scan' { nop }
|
||||
}
|
25
live/source/boot.sh
Normal file
25
live/source/boot.sh
Normal file
|
@ -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}"
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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}" {
|
6
live/source/var.sh
Normal file
6
live/source/var.sh
Normal file
|
@ -0,0 +1,6 @@
|
|||
function var_export {
|
||||
export \
|
||||
data esp \
|
||||
env env_mod \
|
||||
live
|
||||
}
|
26
live/var.sh
26
live/var.sh
|
@ -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 }
|
||||
}
|
Loading…
Reference in a new issue