3 # update-grub helper script.
4 # Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
6 # GRUB is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # GRUB is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 transform
="@program_transform_name@"
22 exec_prefix
=@exec_prefix@
24 grub_prefix
=`echo /boot/grub | sed ${transform}`
26 .
${libdir}/grub
/grub-mkconfig_lib
28 # Do this as early as possible, since other commands might depend on it.
29 # (e.g. the `loadfont' command might need lvm or raid modules)
30 for i
in ${GRUB_PRELOAD_MODULES} ; do
34 if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT
=0 ; fi
35 if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT
=5 ; fi
36 if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE
=640x480
; fi
39 set default=${GRUB_DEFAULT}
40 set timeout=${GRUB_TIMEOUT}
43 case ${GRUB_TERMINAL_INPUT}:${GRUB_TERMINAL_OUTPUT} in
45 if ! test -e ${grub_prefix}/serial.mod
; then
46 echo "Serial terminal not available on this platform." >&2 ; exit 1
49 if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
50 grub_warn
"Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used."
51 GRUB_SERIAL_COMMAND
=serial
53 echo "${GRUB_SERIAL_COMMAND}"
57 case x
${GRUB_TERMINAL_INPUT} in
59 # Just use the native terminal
63 if terminal_input ${GRUB_TERMINAL_INPUT} ; then true ; else
64 # For backward compatibility with versions of terminal.mod that don't
65 # understand terminal_input
66 terminal ${GRUB_TERMINAL_INPUT}
72 case x
${GRUB_TERMINAL_OUTPUT} in
74 # Make the font accessible
75 prepare_grub_to_access_device
`${grub_probe} --target=device ${GRUB_FONT_PATH}`
77 # Pick a video backend
80 if test -e ${grub_prefix}/$i.mod
; then
85 if ! [ "${video_backend}" ] ; then
86 echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
90 if loadfont `make_system_path_relative_to_its_root ${GRUB_FONT_PATH}` ; then
91 set gfxmode=${GRUB_GFXMODE}
93 insmod ${video_backend}
94 if terminal_output gfxterm ; then true ; else
95 # For backward compatibility with versions of terminal.mod that don't
96 # understand terminal_output
103 # Just use the native terminal
107 if terminal_output ${GRUB_TERMINAL_OUTPUT} ; then true ; else
108 # For backward compatibility with versions of terminal.mod that don't
109 # understand terminal_output
110 terminal ${GRUB_TERMINAL_OUTPUT}