lsgm/live/source/menu.sh

54 lines
1.1 KiB
Bash
Raw Normal View History

2023-09-30 12:46:03 +00:00
function menu {
if [ "${1}" ] ; then
2023-09-30 17:52:10 +00:00
menu_load "${1}"
2023-09-30 12:46:03 +00:00
else
2023-09-30 17:52:10 +00:00
export "${menu}"
menu_load "${menu}"
2023-09-30 12:46:03 +00:00
fi
}
function menu_color {
menu_item \
'black' 'blue' 'green' 'cyan' \
'red' 'magenta' 'brown' 'light-gray' \
'dark-gray' 'light-blue' 'light-green' 'light-cyan' \
'light-red' 'light-magenta' 'yellow' 'white'
}
function menu_init {
2023-10-01 17:59:50 +00:00
if [ "${menu}" ] ; then
if [ "${1}" ] ; then
menuentry "${menu}${1}" { nop }
else
menuentry "${menu}" { nop }
fi
menu_split
default=2
2023-09-30 12:46:03 +00:00
fi
}
function menu_item {
eval "default=\"id_\${${menu}}\""
for item in "${@}" ; do
menuentry "${item}" "${menu}" --id "id_${item}" {
eval "${2}=\"${1}\""
menu
}
done
unset item
}
function menu_load {
menu="${1}"
2023-09-30 17:52:10 +00:00
export menu
configfile "${live}/menu/${menu}.sh"
2023-09-30 12:46:03 +00:00
}
function menu_split {
2023-09-30 17:52:10 +00:00
if [ "${1}" ] ; then
menuentry '' --id "${1}" { nop }
else
menuentry '' { nop }
fi
2023-09-30 12:46:03 +00:00
}