4
# grub-mkconfig helper script.
5
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
7
# GRUB is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
12
# GRUB is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20
transform="@program_transform_name@"
23
exec_prefix="@exec_prefix@"
24
datarootdir="@datarootdir@"
25
grub_lang=`echo $LANG | cut -d . -f 1`
27
export TEXTDOMAIN=@PACKAGE@
28
export TEXTDOMAINDIR="@localedir@"
30
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
32
# Do this as early as possible, since other commands might depend on it.
33
# (e.g. the `loadfont' command might need lvm or raid modules)
34
for i in ${GRUB_PRELOAD_MODULES} ; do
38
if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi
39
if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi
40
if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi
41
if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi
43
if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi
44
if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi
45
if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi
48
if [ -s \$prefix/grubenv ]; then
52
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
54
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
55
set default="${GRUB_DEFAULT_BUTTON}"
57
set default="${GRUB_DEFAULT}"
62
set default="${GRUB_DEFAULT}"
67
if [ x"\${feature_menuentry_id}" = xy ]; then
68
menuentry_id_option="--id"
70
menuentry_id_option=""
73
export menuentry_id_option
75
if [ "\${prev_saved_entry}" ]; then
76
set saved_entry="\${prev_saved_entry}"
79
save_env prev_saved_entry
83
function savedefault {
84
if [ -z "\${boot_once}" ]; then
85
saved_entry="\${chosen}"
92
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
94
insmod ${GRUB_VIDEO_BACKEND}
97
# If all_video.mod isn't available load all modules available
98
# with versions prior to introduction of all_video.mod
100
if [ x\$feature_all_video_module = xy ]; then
120
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
121
if [ xserial = "x$x" ]; then
124
if [ xgfxterm = "x$x" ]; then
129
if [ "x$serial" = x1 ]; then
130
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
131
grub_warn "$(gettext "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used.")"
132
GRUB_SERIAL_COMMAND=serial
134
echo "${GRUB_SERIAL_COMMAND}"
137
if [ "x$gfxterm" = x1 ]; then
138
if [ -n "$GRUB_FONT" ] ; then
139
# Make the font accessible
140
prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT}"`
142
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
145
for dir in "${pkgdatadir}" "`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`" /usr/share/grub ; do
146
for basename in unicode unifont ascii; do
147
path="${dir}/${basename}.pf2"
148
if is_path_readable_by_grub "${path}" > /dev/null ; then
156
if [ -n "${font_path}" ] ; then
158
if [ x\$feature_default_font_path = xy ] ; then
162
# Make the font accessible
163
prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`
165
font="`make_system_path_relative_to_its_root "${font_path}"`"
168
if loadfont \$font ; then
172
if loadfont unicode ; then
178
set gfxmode=${GRUB_GFXMODE}
183
# Gettext variables and module
184
if [ "x${LANG}" != "xC" ] ; then
186
set locale_dir=\$prefix/locale
187
set lang=${grub_lang}
197
case x${GRUB_TERMINAL_INPUT} in
199
# Just use the native terminal
203
terminal_input ${GRUB_TERMINAL_INPUT}
208
case x${GRUB_TERMINAL_OUTPUT} in
210
# Just use the native terminal
214
terminal_output ${GRUB_TERMINAL_OUTPUT}
219
if [ "x$gfxterm" = x1 ]; then
220
if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
221
&& is_path_readable_by_grub "$GRUB_THEME"; then
222
gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2
224
prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
228
themedir="`dirname "$GRUB_THEME"`"
229
for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
232
loadfont (\$root)`make_system_path_relative_to_its_root $x`
236
if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
241
if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
246
if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
253
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
256
elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
257
&& is_path_readable_by_grub "$GRUB_BACKGROUND"; then
258
gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2
259
case "$GRUB_BACKGROUND" in
262
*.jpg|*.jpeg) reader=jpeg ;;
263
*) gettext "Unsupported image format" >&2; echo >&2; exit 1 ;;
265
prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
268
background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
275
if [ "x${1}" != "x" ] ; then
276
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
282
if sleep$verbose --interruptible ${1} ; then
293
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
295
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
297
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
299
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
302
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
305
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then
307
cmosclean $GRUB_BUTTON_CMOS_ADDRESS
311
# Play an initial tune
312
if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then
313
echo "play ${GRUB_INIT_TUNE}"
316
if [ "x${GRUB_BADRAM}" != "x" ] ; then
317
echo "badram ${GRUB_BADRAM}"