2008-08-03 Robert Millan <rmh@aybabtu.com>

* util/grub.d/00_header.in: Be platform-agnostic.  Probe for existence
        of modules instead of assuming which platform provides what.
        * util/update-grub.in: Likewise.
This commit is contained in:
robertmh 2008-08-03 16:38:40 +00:00
parent 2d52f57f10
commit 52768e37c2
3 changed files with 48 additions and 21 deletions

View file

@ -16,10 +16,12 @@
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
platform=@platform@
grub_prefix=`echo /boot/grub | sed ${transform}`
. ${libdir}/grub/update-grub_lib
@ -37,20 +39,37 @@ set default=${GRUB_DEFAULT}
set timeout=${GRUB_TIMEOUT}
EOF
case ${platform}:${GRUB_TERMINAL} in
pc:gfxterm)
case x${GRUB_TERMINAL} in
xgfxterm)
# Make the font accessible
prepare_grub_to_access_device `${grub_probe} --target=device ${GRUB_FONT_PATH}`
# Pick a video backend
video_backend=
for i in vbe ; do
if test -e ${grub_prefix}/$i.mod ; then
video_backend=$i
break
fi
done
if ! [ "${video_backend}" ] ; then
echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
fi
cat << EOF
if font `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
set gfxmode=640x480
insmod gfxterm
insmod vbe
insmod ${video_backend}
terminal gfxterm
fi
EOF
;;
*:serial)
xserial)
if ! test -e ${grub_prefix}/serial.mod ; then
echo "Serial terminal not available on this platform." >&2 ; exit 1
fi
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
@ -58,7 +77,10 @@ EOF
echo "${GRUB_SERIAL_COMMAND}"
echo "terminal serial"
;;
*:*)
x)
# Just use the native terminal
;;
x*)
echo "terminal ${GRUB_TERMINAL}"
;;
esac