lsgm/grub.cfg.sh

116 lines
2.2 KiB
Bash
Raw Normal View History

2023-11-10 19:09:15 +00:00
function grub_fix {
unset cmdroot
regexp --set cmdroot '^\((.*)\)' "${cmdpath}"
if [ "${cmdroot}" != "${root}" ] ; then
echo -n "\
|*${cmdpath}
"
if [ -d "(${cmdroot})/boot/grub/${grub_cpu}-${grub_platform}" ] ; then
prefix="(${cmdroot})/boot/grub"
root="${cmdroot}"
fi
fi
unset cmdroot
check_signatures='enforce'
trust --skip-sig "${prefix}/grub.pgp"
}
2023-11-11 15:36:57 +00:00
function grub_init {
load_env \
'live_name' 'data_uuid'
#
regexp --set esp '^\((.*)\)' "${prefix}"
#
env="(${esp})/grub.env"
load_env \
--skip-sig \
--file "${env}" \
'grub_sleep'
#
live="(${esp})/${live_name}/live"
#
search --no-floppy --set data \
--fs-uuid "${data_uuid}"
}
2023-11-10 19:09:15 +00:00
function grub_list_const {
echo -n "\
cpu-platform | ${grub_cpu}-${grub_platform}
cmdpath | ${cmdpath}
"
}
function grub_list_info {
if [ -f '/.disk/info' -o -f '/.disk/mini-info' ] ; then
for f in '/.disk/info' '/.disk/mini-info' ; do
echo -n "\
|"
if [ -f "${f}" ] ; then
echo -n '*'
else
echo -n ' '
fi
echo "(${root})${f}"
done
unset f
fi
}
function grub_list_vars {
echo -n "\
root | ${root}
prefix | ${prefix}
check_signatures | ${check_signatures}
"
list_trusted
}
function grub_list_xtra {
echo -n "\
env | ${env}
live | ${live}
data | ${data}
"
}
function grub_main {
2023-11-14 12:51:37 +00:00
echo '---'
2023-11-10 19:09:15 +00:00
ls
grub_list_const
grub_split
if [ ! "${data}" ] ; then
grub_list_info
grub_list_vars
grub_split
#
grub_fix
2023-11-11 15:36:57 +00:00
grub_init
2023-11-10 19:09:15 +00:00
for file in ${live}/source/*.sh ; do
source "${file}"
done
unset file
source "${live}/main.sh"
fi
grub_list_vars
grub_list_xtra
grub_split
grub_pause
}
function grub_pause {
echo -n "\
escape | "
2023-11-11 15:36:57 +00:00
sleep \
--interruptible \
--verbose \
"${grub_sleep}"
2023-11-10 19:09:15 +00:00
}
function grub_split {
echo -n "\
---
"
}
grub_main