grub-mkconfig multiple terminal support.
* util/grub-mkconfig.in: Handle multiple terminals correctly. * util/grub.d/00_header.in: Likewise.
This commit is contained in:
parent
495442ed02
commit
d5631db0f2
3 changed files with 110 additions and 87 deletions
6
ChangeLog.mtcfg
Normal file
6
ChangeLog.mtcfg
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
2010-04-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
grub-mkconfig multiple terminal support.
|
||||||
|
|
||||||
|
* util/grub-mkconfig.in: Handle multiple terminals correctly.
|
||||||
|
* util/grub.d/00_header.in: Likewise.
|
|
@ -140,60 +140,73 @@ if [ "x${GRUB_TERMINAL}" != "x" ] ; then
|
||||||
GRUB_TERMINAL_OUTPUT="${GRUB_TERMINAL}"
|
GRUB_TERMINAL_OUTPUT="${GRUB_TERMINAL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case x${GRUB_TERMINAL_OUTPUT} in
|
termoutdefault=0
|
||||||
x | xgfxterm)
|
if [ "x${GRUB_TERMINAL_OUTPUT}" == x ]; then
|
||||||
# If this platform supports gfxterm, try to use it.
|
GRUB_TERMINAL_OUTPUT=gfxterm;
|
||||||
if test -e ${grub_prefix}/gfxterm.mod ; then
|
termoutdefault=1;
|
||||||
# FIXME: this should do something smarter than just loading first
|
fi
|
||||||
# video backend.
|
|
||||||
GRUB_VIDEO_BACKEND=$(head -n 1 ${grub_prefix}/video.lst || true)
|
|
||||||
if [ -n "${GRUB_VIDEO_BACKEND}" ] ; then
|
|
||||||
GRUB_TERMINAL_OUTPUT=gfxterm
|
|
||||||
elif [ "${GRUB_TERMINAL_OUTPUT}" = "gfxterm" ] ; then
|
|
||||||
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
xconsole | xserial | xofconsole) ;;
|
|
||||||
*) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# check for terminals that require fonts
|
for x in ${GRUB_TERMINAL_OUTPUT}; do
|
||||||
case ${GRUB_TERMINAL_OUTPUT} in
|
if [ x${x} == xgfxterm ]; then
|
||||||
gfxterm)
|
# If this platform supports gfxterm, try to use it.
|
||||||
if [ -n "$GRUB_FONT" ] ; then
|
if ! test -e ${grub_prefix}/gfxterm.mod ; then
|
||||||
if is_path_readable_by_grub ${GRUB_FONT} > /dev/null ; then
|
if [ "x$termoutdefault" != "x1" ]; then
|
||||||
GRUB_FONT_PATH=${GRUB_FONT}
|
echo "gfxterm isn't available on your platform" >&2 ; exit 1
|
||||||
else
|
fi
|
||||||
echo "No such font or not readable by grub: ${GRUB_FONT}" >&2
|
GRUB_TERMINAL_OUTPUT=
|
||||||
exit 1
|
break;
|
||||||
|
fi
|
||||||
|
# FIXME: this should do something smarter than just loading first
|
||||||
|
# video backend.
|
||||||
|
GRUB_VIDEO_BACKEND=$(head -n 1 ${grub_prefix}/video.lst || true)
|
||||||
|
if [ -z "${GRUB_VIDEO_BACKEND}" ] ; then
|
||||||
|
if [ "x$termoutdefault" != "x1" ]; then
|
||||||
|
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
|
||||||
|
fi
|
||||||
|
GRUB_TERMINAL_OUTPUT=
|
||||||
|
fi
|
||||||
|
if [ -n "$GRUB_FONT" ] ; then
|
||||||
|
if is_path_readable_by_grub ${GRUB_FONT} > /dev/null ; then
|
||||||
|
GRUB_FONT_PATH=${GRUB_FONT}
|
||||||
|
else
|
||||||
|
echo "No such font or not readable by grub: ${GRUB_FONT}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do
|
||||||
|
for basename in unicode unifont ascii; do
|
||||||
|
path="${dir}/${basename}.pf2"
|
||||||
|
if is_path_readable_by_grub ${path} > /dev/null ; then
|
||||||
|
GRUB_FONT_PATH=${path}
|
||||||
|
else
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if [ "${basename}" = "ascii" ] ; then
|
||||||
|
# make sure all our children behave in conformance with ascii..
|
||||||
|
export LANG=C
|
||||||
|
fi
|
||||||
|
break 2
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ -z "${GRUB_FONT_PATH}" ] ; then
|
||||||
|
if [ "x$termoutdefault" != "x1" ]; then
|
||||||
|
echo "No font for gfxterm found." >&2 ; exit 1
|
||||||
|
fi
|
||||||
|
GRUB_TERMINAL_OUTPUT=
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do
|
|
||||||
for basename in unicode unifont ascii; do
|
|
||||||
path="${dir}/${basename}.pf2"
|
|
||||||
if is_path_readable_by_grub ${path} > /dev/null ; then
|
|
||||||
GRUB_FONT_PATH=${path}
|
|
||||||
else
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [ "${basename}" = "ascii" ] ; then
|
|
||||||
# make sure all our children behave in conformance with ascii..
|
|
||||||
export LANG=C
|
|
||||||
fi
|
|
||||||
break 2
|
|
||||||
done
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
if [ -z "${GRUB_FONT_PATH}" ] ; then
|
done
|
||||||
# fallback to the native terminal for this platform
|
|
||||||
unset GRUB_TERMINAL_OUTPUT
|
for x in ${GRUB_TERMINAL_OUTPUT}; do
|
||||||
fi
|
case "x${x}" in
|
||||||
;;
|
xgfxterm) ;;
|
||||||
*)
|
xconsole | xserial | xofconsole)
|
||||||
# make sure all our children behave in conformance with ascii..
|
# make sure all our children behave in conformance with ascii..
|
||||||
export LANG=C
|
export LANG=C;;
|
||||||
esac
|
*) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# These are defined in this script, export them here so that user can
|
# These are defined in this script, export them here so that user can
|
||||||
# override them.
|
# override them.
|
||||||
|
|
|
@ -59,19 +59,52 @@ function savedefault {
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
|
serial=0;
|
||||||
serial:* | *:serial)
|
gfxterm=0;
|
||||||
|
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
|
||||||
|
if [ xserial = "x$x" ]; then
|
||||||
|
serial=1;
|
||||||
|
fi
|
||||||
|
if [ xgfxterm = "x$x" ]; then
|
||||||
|
gfxterm=1;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "x$serial" = x1 ]; then
|
||||||
if ! test -e ${grub_prefix}/serial.mod ; then
|
if ! test -e ${grub_prefix}/serial.mod ; then
|
||||||
echo "Serial terminal not available on this platform." >&2 ; exit 1
|
echo "Serial terminal not available on this platform." >&2 ; exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
|
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
|
||||||
grub_warn "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used."
|
grub_warn "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used."
|
||||||
GRUB_SERIAL_COMMAND=serial
|
GRUB_SERIAL_COMMAND=serial
|
||||||
fi
|
fi
|
||||||
echo "${GRUB_SERIAL_COMMAND}"
|
echo "${GRUB_SERIAL_COMMAND}"
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
|
if [ "x$gfxterm" = x1 ]; then
|
||||||
|
# Make the font accessible
|
||||||
|
prepare_grub_to_access_device `${grub_probe} --target=device ${GRUB_FONT_PATH}`
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
|
||||||
|
set gfxmode=${GRUB_GFXMODE}
|
||||||
|
insmod gfxterm
|
||||||
|
insmod ${GRUB_VIDEO_BACKEND}
|
||||||
|
EOF
|
||||||
|
if [ x$GRUB_THEME != x ] && [ -f $GRUB_THEME ] \
|
||||||
|
&& is_path_readable_by_grub $GRUB_THEME; then
|
||||||
|
echo "Found theme: $GRUB_THEME" >&2
|
||||||
|
prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_THEME` | sed -e "s/^/ /"
|
||||||
|
cat << EOF
|
||||||
|
insmod gfxmenu
|
||||||
|
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
cat << EOF
|
||||||
|
fi
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
case x${GRUB_TERMINAL_INPUT} in
|
case x${GRUB_TERMINAL_INPUT} in
|
||||||
x)
|
x)
|
||||||
|
@ -89,35 +122,6 @@ EOF
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case x${GRUB_TERMINAL_OUTPUT} in
|
case x${GRUB_TERMINAL_OUTPUT} in
|
||||||
xgfxterm)
|
|
||||||
# Make the font accessible
|
|
||||||
prepare_grub_to_access_device `${grub_probe} --target=device ${GRUB_FONT_PATH}`
|
|
||||||
|
|
||||||
cat << EOF
|
|
||||||
if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
|
|
||||||
set gfxmode=${GRUB_GFXMODE}
|
|
||||||
insmod gfxterm
|
|
||||||
insmod ${GRUB_VIDEO_BACKEND}
|
|
||||||
if terminal_output gfxterm ; then true ; else
|
|
||||||
# For backward compatibility with versions of terminal.mod that don't
|
|
||||||
# understand terminal_output
|
|
||||||
terminal gfxterm
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
if [ x$GRUB_THEME != x ] && [ -f $GRUB_THEME ] \
|
|
||||||
&& is_path_readable_by_grub $GRUB_THEME; then
|
|
||||||
echo "Found theme: $GRUB_THEME" >&2
|
|
||||||
prepare_grub_to_access_device `${grub_probe} --target=device $GRUB_THEME` | sed -e "s/^/ /"
|
|
||||||
cat << EOF
|
|
||||||
insmod gfxmenu
|
|
||||||
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
|
|
||||||
set menuviewer=gfxmenu
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
cat << EOF
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
;;
|
|
||||||
x)
|
x)
|
||||||
# Just use the native terminal
|
# Just use the native terminal
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue