~ilya-yanok/ubuntu/precise/grub2/fix-for-948716

« back to all changes in this revision

Viewing changes to util/grub-mkconfig.in

  • Committer: Bazaar Package Importer
  • Author(s): Robert Millan
  • Date: 2009-07-25 19:00:53 UTC
  • mfrom: (1.6.3 upstream)
  • mto: (17.4.13 sid)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: james.westby@ubuntu.com-20090725190053-uv3lm6ya3zxs77ep
ImportĀ upstreamĀ versionĀ 1.96+20090725

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
sbindir=@sbindir@
24
24
libdir=@libdir@
25
25
sysconfdir=@sysconfdir@
26
 
package_version=@PACKAGE_VERSION@
27
 
datarootdir=@datarootdir@
28
 
datadir=@datadir@
29
 
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
30
26
grub_prefix=`echo /boot/grub | sed ${transform}`
31
27
grub_cfg=""
32
28
grub_mkconfig_dir=${sysconfdir}/grub.d
56
52
        usage
57
53
        exit 0 ;;
58
54
    -v | --version)
59
 
        echo "$0 (GNU GRUB ${package_version})"
 
55
        echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
60
56
        exit 0 ;;
61
57
    -o)
62
58
        shift
141
137
fi
142
138
 
143
139
case x${GRUB_TERMINAL_OUTPUT} in
144
 
  x | xgfxterm)
 
140
  x)
145
141
    # If this platform supports gfxterm, try to use it.
146
142
    if test -e ${grub_prefix}/gfxterm.mod ; then
147
 
      GRUB_VIDEO_BACKEND=
148
 
      for i in vbe ; do
149
 
        if test -e ${grub_prefix}/$i.mod ; then
150
 
          GRUB_VIDEO_BACKEND=$i
151
 
          break
152
 
        fi
153
 
      done
154
 
      if [ -n "${GRUB_VIDEO_BACKEND}" ] ; then
155
 
        GRUB_TERMINAL_OUTPUT=gfxterm
156
 
      elif [ "${GRUB_TERMINAL_OUTPUT}" = "gfxterm" ] ; then
157
 
        echo "No suitable backend could be found for gfxterm." >&2 ; exit 1
158
 
      fi
 
143
      GRUB_TERMINAL_OUTPUT=gfxterm
159
144
    fi
160
145
  ;;
161
 
  xconsole | xserial | xofconsole) ;;
 
146
  xconsole | xserial | xofconsole | xgfxterm) ;;
162
147
  *) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
163
148
esac
164
149
 
165
150
# check for terminals that require fonts
166
151
case ${GRUB_TERMINAL_OUTPUT} in
167
152
  gfxterm)
168
 
    if [ -n "$GRUB_FONT" ] ; then
169
 
      if is_path_readable_by_grub ${GRUB_FONT} > /dev/null ; then
170
 
        GRUB_FONT_PATH=${GRUB_FONT}
171
 
        else
172
 
          echo "No such font or not readable by grub: ${GRUB_FONT}" >&2
173
 
          exit 1
174
 
        fi
 
153
    if path=`font_path` ; then
 
154
      GRUB_FONT_PATH="${path}"
175
155
    else
176
 
      for dir in ${pkgdatadir} /boot/grub /usr/share/grub ; do
177
 
        for basename in unicode unifont ascii; do
178
 
          path="${dir}/${basename}.pf2"
179
 
          if is_path_readable_by_grub ${path} > /dev/null ; then
180
 
            GRUB_FONT_PATH=${path}
181
 
          else
182
 
            continue
183
 
          fi
184
 
          if [ "${basename}" = "ascii" ] ; then
185
 
            # make sure all our children behave in conformance with ascii..
186
 
            export LANG=C
187
 
          fi
188
 
          break 2
189
 
        done
190
 
      done
191
 
    fi
192
 
    if [ -z "${GRUB_FONT_PATH}" ] ; then
193
156
      # fallback to the native terminal for this platform
194
157
      unset GRUB_TERMINAL_OUTPUT
195
158
    fi
196
159
  ;;
 
160
esac
 
161
 
 
162
# does our terminal support utf-8 ?
 
163
case ${GRUB_TERMINAL_OUTPUT} in
 
164
  gfxterm) ;;
197
165
  *)
198
166
    # make sure all our children behave in conformance with ascii..
199
167
    export LANG=C
 
168
  ;;
200
169
esac
201
170
 
202
171
# These are defined in this script, export them here so that user can
203
172
# override them.
204
 
export GRUB_DEVICE \
205
 
  GRUB_DEVICE_UUID \
206
 
  GRUB_DEVICE_BOOT \
207
 
  GRUB_DEVICE_BOOT_UUID \
208
 
  GRUB_FS \
209
 
  GRUB_FONT_PATH \
210
 
  GRUB_PRELOAD_MODULES \
211
 
  GRUB_VIDEO_BACKEND
 
173
export GRUB_DEVICE GRUB_DEVICE_UUID GRUB_DEVICE_BOOT GRUB_DEVICE_BOOT_UUID GRUB_FS GRUB_FONT_PATH GRUB_PRELOAD_MODULES
212
174
 
213
175
# These are optional, user-defined variables.
214
 
export GRUB_DEFAULT \
215
 
  GRUB_HIDDEN_TIMEOUT \
216
 
  GRUB_HIDDEN_TIMEOUT_QUIET \
217
 
  GRUB_TIMEOUT \
218
 
  GRUB_DISTRIBUTOR \
219
 
  GRUB_CMDLINE_LINUX \
220
 
  GRUB_CMDLINE_LINUX_DEFAULT \
221
 
  GRUB_TERMINAL_INPUT \
222
 
  GRUB_TERMINAL_OUTPUT \
223
 
  GRUB_SERIAL_COMMAND \
224
 
  GRUB_DISABLE_LINUX_UUID \
225
 
  GRUB_DISABLE_LINUX_RECOVERY \
226
 
  GRUB_GFXMODE \
227
 
  GRUB_DISABLE_OS_PROBER
 
176
export GRUB_DEFAULT GRUB_TIMEOUT GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_TERMINAL_INPUT GRUB_TERMINAL_OUTPUT GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID GRUB_DISABLE_LINUX_RECOVERY GRUB_GFXMODE
228
177
 
229
178
if test "x${grub_cfg}" != "x"; then
230
179
  rm -f ${grub_cfg}.new
232
181
 
233
182
  # Allow this to fail, since /boot/grub/ might need to be fatfs to support some
234
183
  # firmware implementations (e.g. OFW or EFI).
235
 
  chmod 400 ${grub_cfg}.new || grub_warn "Could not make ${grub_cfg}.new readable by only root.\
236
 
  This means that if the generated config contains a password it is readable by everyone"
 
184
  chmod 444 ${grub_cfg}.new || true
237
185
fi
238
186
echo "Generating grub.cfg ..." >&2
239
187