lsgm/grub.cfg.sh

115 lines
2.2 KiB
Bash

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"
}
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}"
}
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 {
echo '---'
ls
grub_list_const
grub_split
if [ ! "${data}" ] ; then
grub_list_info
grub_list_vars
grub_split
#
grub_fix
grub_init
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 | "
sleep \
--interruptible \
--verbose \
"${grub_sleep}"
}
function grub_split {
echo -n "\
---
"
}
grub_main