]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-08-03 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Sun, 3 Aug 2008 16:38:40 +0000 (16:38 +0000)
committerrobertmh <robertmh@localhost>
Sun, 3 Aug 2008 16:38:40 +0000 (16:38 +0000)
        * 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.

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

index 5989ecb134b1e8ab821f2c19134cbd27155eec48..e60ca752a16dec8b49eb17abd0114fe9db435e42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
 2008-08-03  Robert Millan  <rmh@aybabtu.com>
 
        * kern/i386/pc/init.c (make_install_device): Check for `grub_prefix'
index bf9507c884d4031f1ace96d118ceece3a150c3c8..007c0268c0155de233902989c73bc84aee1ee97f 100644 (file)
 # 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
index 70607a50ef610a80b12d6880245eb3125651d880..8c60c412f37986cc67da0b438e8cb6ed7ef33c42 100644 (file)
@@ -26,7 +26,6 @@ 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}`
@@ -127,15 +126,15 @@ 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 ;;
-  ieee1275:)                   GRUB_TERMINAL=ofconsole ;;
-  *:)                          GRUB_TERMINAL=console ;;
-  pc:console | pc:serial | ieee1275:ofconsole | ieee1275:console | *:gfxterm)
-                               ;;
-  *:*)                         echo "Invalid terminal \"${GRUB_TERMINAL}\"" >&2 ; exit 1 ;;
+case x${GRUB_TERMINAL} in
+  x)
+    # If this platform supports gfxterm, try to use it.
+    if test -e ${grub_prefix}/gfxterm.mod ; then
+      GRUB_TERMINAL=gfxterm
+    fi
+  ;;
+  xconsole | xserial | xofconsole | xgfxterm) ;;
+  *) echo "Invalid terminal \"${GRUB_TERMINAL}\"" >&2 ; exit 1 ;;
 esac
 
 # check for terminals that require fonts
@@ -144,16 +143,16 @@ case ${GRUB_TERMINAL} in
     if path=`font_path` ; then
       GRUB_FONT_PATH="${path}"
     else
-      # fallback to console
-      GRUB_TERMINAL=console
+      # fallback to the native terminal for this platform
+      unset GRUB_TERMINAL
     fi
   ;;
 esac
 
 # does our terminal support utf-8 ?
-case ${platform}:${GRUB_TERMINAL} in
-  *:gfxterm) ;;
-  *:*)
+case ${GRUB_TERMINAL} in
+  gfxterm) ;;
+  *)
     # make sure all our children behave in conformance with ascii..
     export LANG=C
   ;;