~ubuntu-branches/ubuntu/trusty/grub2/trusty

« back to all changes in this revision

Viewing changes to .pc/timeout_style.patch/util/grub.d/00_header.in

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-01-16 15:18:04 UTC
  • mfrom: (17.6.38 experimental)
  • Revision ID: package-import@ubuntu.com-20140116151804-3foouk7fpqcq3sxx
Tags: 2.02~beta2-2
* Convert patch handling to git-dpm.
* Add bi-endian support to ELF parser (Tomohiro B Berry).
* Adjust restore_mkdevicemap.patch to mark get_kfreebsd_version as static,
  to appease "gcc -Werror=missing-prototypes".
* Cherry-pick from upstream:
  - Change grub-macbless' manual page section to 8.
* Install grub-glue-efi, grub-macbless, grub-render-label, and
  grub-syslinux2cfg.
* grub-shell: Pass -no-pad to xorriso when building floppy images.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
set -e
3
 
 
4
 
# grub-mkconfig helper script.
5
 
# Copyright (C) 2006,2007,2008,2009,2010  Free Software Foundation, Inc.
6
 
#
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.
11
 
#
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.
16
 
#
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/>.
19
 
 
20
 
transform="@program_transform_name@"
21
 
 
22
 
prefix="@prefix@"
23
 
exec_prefix="@exec_prefix@"
24
 
datarootdir="@datarootdir@"
25
 
grub_lang=`echo $LANG | cut -d . -f 1`
26
 
 
27
 
export TEXTDOMAIN=@PACKAGE@
28
 
export TEXTDOMAINDIR="@localedir@"
29
 
 
30
 
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
31
 
 
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
35
 
  echo "insmod $i"
36
 
done
37
 
 
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
42
 
 
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
46
 
 
47
 
cat << EOF
48
 
if [ -s \$prefix/grubenv ]; then
49
 
  load_env
50
 
fi
51
 
EOF
52
 
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
53
 
    cat <<EOF
54
 
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
55
 
   set default="${GRUB_DEFAULT_BUTTON}"
56
 
else
57
 
   set default="${GRUB_DEFAULT}"
58
 
fi
59
 
EOF
60
 
else
61
 
    cat <<EOF
62
 
set default="${GRUB_DEFAULT}"
63
 
EOF
64
 
fi
65
 
cat <<EOF
66
 
 
67
 
if [ x"\${feature_menuentry_id}" = xy ]; then
68
 
  menuentry_id_option="--id"
69
 
else
70
 
  menuentry_id_option=""
71
 
fi
72
 
 
73
 
export menuentry_id_option
74
 
 
75
 
if [ "\${prev_saved_entry}" ]; then
76
 
  set saved_entry="\${prev_saved_entry}"
77
 
  save_env saved_entry
78
 
  set prev_saved_entry=
79
 
  save_env prev_saved_entry
80
 
  set boot_once=true
81
 
fi
82
 
 
83
 
function savedefault {
84
 
  if [ -z "\${boot_once}" ]; then
85
 
    saved_entry="\${chosen}"
86
 
    save_env saved_entry
87
 
  fi
88
 
}
89
 
 
90
 
function load_video {
91
 
EOF
92
 
if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
93
 
    cat <<EOF
94
 
  insmod ${GRUB_VIDEO_BACKEND}
95
 
EOF
96
 
else
97
 
# If all_video.mod isn't available load all modules available
98
 
# with versions prior to introduction of all_video.mod
99
 
cat <<EOF
100
 
  if [ x\$feature_all_video_module = xy ]; then
101
 
    insmod all_video
102
 
  else
103
 
    insmod efi_gop
104
 
    insmod efi_uga
105
 
    insmod ieee1275_fb
106
 
    insmod vbe
107
 
    insmod vga
108
 
    insmod video_bochs
109
 
    insmod video_cirrus
110
 
  fi
111
 
EOF
112
 
fi
113
 
cat <<EOF
114
 
}
115
 
 
116
 
EOF
117
 
 
118
 
serial=0;
119
 
gfxterm=0;
120
 
for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
121
 
    if [ xserial = "x$x" ]; then
122
 
        serial=1;
123
 
    fi
124
 
    if [ xgfxterm = "x$x" ]; then
125
 
        gfxterm=1;
126
 
    fi
127
 
done
128
 
 
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
133
 
    fi
134
 
    echo "${GRUB_SERIAL_COMMAND}"
135
 
fi
136
 
 
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}"`
141
 
    cat << EOF
142
 
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
143
 
EOF
144
 
    else
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
149
 
                    font_path="${path}"
150
 
                else
151
 
                    continue
152
 
                fi
153
 
                break 2
154
 
            done
155
 
        done
156
 
        if [ -n "${font_path}" ] ; then
157
 
    cat << EOF
158
 
if [ x\$feature_default_font_path = xy ] ; then
159
 
   font=unicode
160
 
else
161
 
EOF
162
 
                # Make the font accessible
163
 
                prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`
164
 
    cat << EOF
165
 
    font="`make_system_path_relative_to_its_root "${font_path}"`"
166
 
fi
167
 
 
168
 
if loadfont \$font ; then
169
 
EOF
170
 
            else
171
 
    cat << EOF
172
 
if loadfont unicode ; then
173
 
EOF
174
 
            fi
175
 
        fi
176
 
 
177
 
    cat << EOF
178
 
  set gfxmode=${GRUB_GFXMODE}
179
 
  load_video
180
 
  insmod gfxterm
181
 
EOF
182
 
 
183
 
# Gettext variables and module
184
 
if [ "x${LANG}" != "xC" ] ; then
185
 
  cat << EOF
186
 
  set locale_dir=\$prefix/locale
187
 
  set lang=${grub_lang}
188
 
  insmod gettext
189
 
EOF
190
 
fi
191
 
 
192
 
cat <<EOF
193
 
fi
194
 
EOF
195
 
fi
196
 
 
197
 
case x${GRUB_TERMINAL_INPUT} in
198
 
  x)
199
 
    # Just use the native terminal
200
 
  ;;
201
 
  x*)
202
 
    cat << EOF
203
 
terminal_input ${GRUB_TERMINAL_INPUT}
204
 
EOF
205
 
  ;;
206
 
esac
207
 
 
208
 
case x${GRUB_TERMINAL_OUTPUT} in
209
 
  x)
210
 
    # Just use the native terminal
211
 
  ;;
212
 
  x*)
213
 
    cat << EOF
214
 
terminal_output ${GRUB_TERMINAL_OUTPUT}
215
 
EOF
216
 
  ;;
217
 
esac
218
 
 
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
223
 
 
224
 
        prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
225
 
        cat << EOF
226
 
insmod gfxmenu
227
 
EOF
228
 
        themedir="`dirname "$GRUB_THEME"`"
229
 
        for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do
230
 
            if [ -f "$x" ]; then
231
 
                cat << EOF
232
 
loadfont (\$root)`make_system_path_relative_to_its_root $x`
233
 
EOF
234
 
            fi
235
 
        done
236
 
        if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then
237
 
            cat << EOF
238
 
insmod jpeg
239
 
EOF
240
 
        fi
241
 
        if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then
242
 
            cat << EOF
243
 
insmod png
244
 
EOF
245
 
        fi
246
 
        if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then
247
 
            cat << EOF
248
 
insmod tga
249
 
EOF
250
 
        fi
251
 
            
252
 
        cat << EOF
253
 
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
254
 
export theme
255
 
EOF
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 
260
 
            *.png)         reader=png ;;
261
 
            *.tga)         reader=tga ;;
262
 
            *.jpg|*.jpeg)  reader=jpeg ;;
263
 
            *)             gettext "Unsupported image format" >&2; echo >&2; exit 1 ;;
264
 
        esac
265
 
        prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
266
 
        cat << EOF
267
 
insmod $reader
268
 
background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
269
 
EOF
270
 
    fi
271
 
fi
272
 
 
273
 
make_timeout ()
274
 
{
275
 
    if [ "x${1}" != "x" ] ; then
276
 
        if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
277
 
            verbose=
278
 
        else
279
 
            verbose=" --verbose"
280
 
        fi
281
 
        cat << EOF
282
 
if sleep$verbose --interruptible ${1} ; then
283
 
  set timeout=${2}
284
 
fi
285
 
EOF
286
 
    else
287
 
        cat << EOF
288
 
set timeout=${2}
289
 
EOF
290
 
    fi
291
 
}
292
 
 
293
 
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
294
 
    cat <<EOF
295
 
if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
296
 
EOF
297
 
make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
298
 
echo else
299
 
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
300
 
echo fi
301
 
else
302
 
make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
303
 
fi
304
 
 
305
 
if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then
306
 
    cat <<EOF
307
 
cmosclean $GRUB_BUTTON_CMOS_ADDRESS
308
 
EOF
309
 
fi
310
 
 
311
 
# Play an initial tune
312
 
if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then
313
 
  echo "play ${GRUB_INIT_TUNE}"
314
 
fi
315
 
 
316
 
if [ "x${GRUB_BADRAM}" != "x" ] ; then
317
 
  echo "badram ${GRUB_BADRAM}"
318
 
fi