107 lines
2.1 KiB
Bash
107 lines
2.1 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_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 {
|
|
ls
|
|
grub_list_const
|
|
grub_split
|
|
if [ ! "${data}" ] ; then
|
|
grub_list_info
|
|
grub_list_vars
|
|
grub_split
|
|
#
|
|
grub_fix
|
|
set_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 1000
|
|
}
|
|
|
|
function grub_split {
|
|
echo -n "\
|
|
---
|
|
"
|
|
}
|
|
|
|
function set_init {
|
|
regexp --set esp '^\((.*)\)' "${prefix}"
|
|
#
|
|
env="(${esp})/grub.env"
|
|
#
|
|
load_env --skip-sig --file "${env}" \
|
|
'live_name' 'data_uuid'
|
|
#
|
|
live="(${esp})/${live_name}/live"
|
|
#
|
|
search --no-floppy --set data \
|
|
--fs-uuid "${data_uuid}"
|
|
}
|
|
|
|
grub_main
|