2007-06-23 Robert Millan <rmh@aybabtu.com>
* util/update-grub_lib.in (font_path): New function. Determine wether a font file can be found and, if so, echo the GRUB path to it. * util/update-grub.in: Handle multiple terminals depending on user input, platform availability and font file presence. Propagate variables of our findings to /etc/grub.d/ children. * util/grub.d/00_header.in: Handle multiple terminals, based on environment setup by update-grub.
This commit is contained in:
parent
73167f1dc5
commit
6193defe9f
4 changed files with 84 additions and 16 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2007-06-23 Robert Millan <rmh@aybabtu.com>
|
||||
|
||||
* util/update-grub_lib.in (font_path): New function. Determine wether
|
||||
a font file can be found and, if so, echo the GRUB path to it.
|
||||
|
||||
* util/update-grub.in: Handle multiple terminals depending on user
|
||||
input, platform availability and font file presence. Propagate
|
||||
variables of our findings to /etc/grub.d/ children.
|
||||
|
||||
* util/grub.d/00_header.in: Handle multiple terminals, based on
|
||||
environment setup by update-grub.
|
||||
|
||||
2007-06-23 Robert Millan <rmh@aybabtu.com>
|
||||
|
||||
* conf/i386-pc.rmk (pkgdata_MODULES): Add serial.mod.
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
platform=@platform@
|
||||
|
||||
# for convert_system_path_to_grub_path()
|
||||
. ${libdir}/grub/update-grub_lib
|
||||
|
@ -33,23 +34,27 @@ set timeout=${GRUB_TIMEOUT}
|
|||
EOF
|
||||
|
||||
if [ "x${GRUB_DRIVE}" = "x" ] ; then : ; else
|
||||
cat << EOF
|
||||
set root=${GRUB_DRIVE}
|
||||
EOF
|
||||
echo "set root=${GRUB_DRIVE}"
|
||||
fi
|
||||
|
||||
# Prefer system path for space reasons (/boot/grub might be a very small
|
||||
# partition in case of OpenFirmware, etc).
|
||||
for i in /usr/share/grub/unifont.pff /boot/grub/unifont.pff ; do
|
||||
if grub_path=`convert_system_path_to_grub_path $i` ; then
|
||||
cat << EOF
|
||||
if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
|
||||
echo "font ${GRUB_FONT_PATH}"
|
||||
fi
|
||||
|
||||
font ${grub_path}
|
||||
case ${platform}:${GRUB_TERMINAL} in
|
||||
pc:gfxterm) cat << EOF
|
||||
set gfxmode=640x480
|
||||
insmod gfxterm
|
||||
insmod vbe
|
||||
terminal gfxterm
|
||||
EOF
|
||||
break
|
||||
;;
|
||||
*:serial)
|
||||
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
|
||||
echo "Warning, requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used." >&2
|
||||
GRUB_SERIAL_COMMAND=serial
|
||||
fi
|
||||
done
|
||||
echo "${GRUB_SERIAL_COMMAND}"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "terminal ${GRUB_TERMINAL}"
|
||||
|
|
|
@ -27,11 +27,12 @@ sysconfdir=@sysconfdir@
|
|||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
grub_cfg=${grub_prefix}/grub.cfg
|
||||
update_grub_dir=${sysconfdir}/grub.d
|
||||
platform=@platform@
|
||||
|
||||
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
|
||||
# for convert_system_path_to_grub_path()
|
||||
# for convert_system_path_to_grub_path(), font_path()
|
||||
. ${libdir}/grub/update-grub_lib
|
||||
|
||||
if [ "x$UID" = "x" ] ; then
|
||||
|
@ -89,12 +90,42 @@ if test -f ${sysconfdir}/default/grub ; then
|
|||
. ${sysconfdir}/default/grub
|
||||
fi
|
||||
|
||||
# if ${GRUB_TERMINAL} is set, check it has a sane value. if undefined,
|
||||
# fallback to our default
|
||||
case ${platform}:${GRUB_TERMINAL} in
|
||||
pc:) GRUB_TERMINAL=gfxterm ;;
|
||||
pc:console | pc:serial) ;;
|
||||
ieee1275:) GRUB_TERMINAL=ofconsole ;;
|
||||
ieee1275:ofconsole) ;;
|
||||
*:) GRUB_TERMINAL=console ;;
|
||||
*:*) echo "Invalid terminal \"${GRUB_TERMINAL}\"" >&2 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
# check for terminals that require fonts
|
||||
case ${GRUB_TERMINAL} in
|
||||
gfxterm)
|
||||
if GRUB_FONT_PATH=`font_path` ; then : ; else
|
||||
# fallback to console
|
||||
GRUB_TERMINAL=console
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# does our terminal support utf-8 ?
|
||||
case ${platform}:${GRUB_TERMINAL} in
|
||||
*:gfxterm) ;;
|
||||
*:*)
|
||||
# make sure all our children behave in conformance with ascii..
|
||||
export LANG=C
|
||||
;;
|
||||
esac
|
||||
|
||||
# These are defined in this script, export them here so that user can
|
||||
# override them.
|
||||
export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB
|
||||
export GRUB_DEVICE GRUB_FS GRUB_DRIVE GRUB_DRIVE_BOOT GRUB_DRIVE_BOOT_GRUB GRUB_FONT_PATH
|
||||
|
||||
# These are optional, user-defined variables.
|
||||
export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX
|
||||
export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_TERMINAL GRUB_SERIAL_COMMAND
|
||||
|
||||
exec > ${grub_cfg}.new
|
||||
chmod 444 ${grub_cfg}.new
|
||||
|
|
|
@ -89,3 +89,23 @@ convert_system_path_to_grub_path ()
|
|||
|
||||
echo ${drive}${relative_path}
|
||||
}
|
||||
|
||||
font_path ()
|
||||
{
|
||||
if [ "x${GRUB_FONT_PATH}" = "x" ] ; then : ; else
|
||||
echo "${GRUB_FONT_PATH}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Prefer system path for space reasons (/boot/grub might be a very small
|
||||
# partition in case of OpenFirmware, etc).
|
||||
for i in /usr/share/grub/unifont.pff /boot/grub/unifont.pff ; do
|
||||
if path=`convert_system_path_to_grub_path $i` ; then
|
||||
GRUB_FONT_PATH="${path}"
|
||||
echo "${GRUB_FONT_PATH}"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue