]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2007-06-23 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Sat, 23 Jun 2007 19:34:57 +0000 (19:34 +0000)
committerrobertmh <robertmh@localhost>
Sat, 23 Jun 2007 19:34:57 +0000 (19:34 +0000)
* 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.

ChangeLog
util/grub.d/00_header.in
util/update-grub.in
util/update-grub_lib.in

index 04deaeb040c44e08507d438c51a33d6c4e53cb9c..be4d19e3799e9e71e6cda45b886372583b25498f 100644 (file)
--- a/ChangeLog
+++ b/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.
index 6336762115c9d48bc6e0e1dd5386ff5217d929e9..cfe4ed4b2cecfbb13d116acf8695e7693bb88255 100644 (file)
@@ -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
-  fi
-done
+  ;;
+  *: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
+    echo "${GRUB_SERIAL_COMMAND}"
+  ;;
+esac
+
+echo "terminal ${GRUB_TERMINAL}"
index c1ecf38a5591e8e9bfc4c7f17e4ab689970d8238..76801b8545a09e6155cebea81ab3464bb77c7fa3 100644 (file)
@@ -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
index 938eafc1f5cb59ac873d49cef1f10b46f9ee10d4..6a46245329bf6d01ea24f55f24e401d423a14513 100644 (file)
@@ -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
+}