~hamo/ubuntu/precise/grub2/grub2.hi_res

« back to all changes in this revision

Viewing changes to util/grub-mkconfig_lib.in

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Robert Millan, Updated translations
  • Date: 2010-11-22 12:24:56 UTC
  • mfrom: (1.26.4 upstream) (17.3.36 sid)
  • mto: (17.3.43 sid)
  • mto: This revision was merged to the branch mainline in revision 89.
  • Revision ID: james.westby@ubuntu.com-20101122122456-y82z3sfb7k4zfdcc
Tags: 1.99~20101122-1
[ Colin Watson ]
* New Bazaar snapshot.  Too many changes to list in full, but some of the
  more user-visible ones are as follows:
  - GRUB script:
    + Function parameters, "break", "continue", "shift", "setparams",
      "return", and "!".
    + "export" command supports multiple variable names.
    + Multi-line quoted strings support.
    + Wildcard expansion.
  - sendkey support.
  - USB hotunplugging and USB serial support.
  - Rename CD-ROM to cd on BIOS.
  - Add new --boot-directory option to grub-install, grub-reboot, and
    grub-set-default; the old --root-directory option is still accepted
    but was often confusing.
  - Basic btrfs detection/UUID support (but no file reading yet).
  - bash-completion for utilities.
  - If a device is listed in device.map, always assume that it is
    BIOS-visible rather than using extra layers such as LVM or RAID.
  - Add grub-mknetdir script (closes: #550658).
  - Remove deprecated "root" command.
  - Handle RAID devices containing virtio components.
  - GRUB Legacy configuration file support (via grub-menulst2cfg).
  - Keyboard layout support (via grub-mklayout and grub-kbdcomp).
  - Check generated grub.cfg for syntax errors before saving.
  - Pause execution for at most ten seconds if any errors are displayed,
    so that the user has a chance to see them.
  - Support submenus.
  - Write embedding zone using Reed-Solomon, so that it's robust against
    being partially overwritten (closes: #550702, #591416, #593347).
  - GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY merged
    into a single GRUB_DISABLE_RECOVERY variable.
  - Fix loader memory allocation failure (closes: #551627).
  - Don't call savedefault on recovery entries (closes: #589325).
  - Support triple-indirect blocks on ext2 (closes: #543924).
  - Recognise DDF1 fake RAID (closes: #603354).

[ Robert Millan ]
* Use dpkg architecture wildcards.

[ Updated translations ]
* Slovenian (Vanja Cvelbar).  Closes: #604003
* Dzongkha (dawa pemo via Tenzin Dendup).  Closes: #604102

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Helper library for grub-mkconfig
2
 
# Copyright (C) 2007,2008,2009  Free Software Foundation, Inc.
 
2
# Copyright (C) 2007,2008,2009,2010  Free Software Foundation, Inc.
3
3
#
4
4
# GRUB is free software: you can redistribute it and/or modify
5
5
# it under the terms of the GNU General Public License as published by
31
31
  grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
32
32
fi
33
33
 
 
34
if $(which gettext >/dev/null 2>/dev/null) ; then
 
35
  gettext="gettext"
 
36
else
 
37
  gettext="echo"
 
38
fi
 
39
 
34
40
grub_warn ()
35
41
{
36
42
  echo "Warning: $@" >&2
38
44
 
39
45
make_system_path_relative_to_its_root ()
40
46
{
41
 
  path="`${grub_mkrelpath} $1`"
42
 
 
43
 
  case "`uname 2>/dev/null`" in
44
 
    CYGWIN*)
45
 
      # Cygwin: Check if regular or emulated mount.
46
 
      if [ -z "$dir" ] || [ "`stat -c %D "$dir/.."`" != 620000 ] ; then
47
 
        # Reached some mount point not below /cygdrive.
48
 
        # GRUB does not know Cygwin's emulated mounts,
49
 
        # convert to Win32 path and remove drive letter.
50
 
        path=`cygpath -m "$path" | sed -n 's,^[A-Za-z]:,,p'`
51
 
        test ! -z "$path" || return 1
52
 
      fi ;;
53
 
  esac
54
 
 
55
 
  echo "$path"
 
47
  ${grub_mkrelpath} $1
56
48
}
57
49
 
58
50
is_path_readable_by_grub ()
96
88
 
97
89
save_default_entry ()
98
90
{
99
 
  if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then
 
91
  if [ "x${GRUB_SAVEDEFAULT}" = "xtrue" ] ; then
100
92
    cat << EOF
101
93
savedefault
102
94
EOF
113
105
    echo "insmod ${module}"
114
106
  done
115
107
 
 
108
  partmap="`${grub_probe} --device ${device} --target=partmap`"
 
109
  for module in ${partmap} ; do
 
110
    echo "insmod part_${module}"
 
111
  done
 
112
 
116
113
  fs="`${grub_probe} --device ${device} --target=fs`"
117
114
  for module in ${fs} ; do
118
115
    echo "insmod ${module}"
120
117
 
121
118
  # If there's a filesystem UUID that GRUB is capable of identifying, use it;
122
119
  # otherwise set root as per value in device.map.
123
 
  echo "set root=`${grub_probe} --device ${device} --target=drive`"
 
120
  echo "set root='`${grub_probe} --device ${device} --target=drive`'"
124
121
  if fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
125
 
    echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
 
122
    echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
126
123
  fi
127
124
}
128
125
 
131
128
  if test -f "$1" ; then
132
129
    case "$1" in
133
130
      *.dpkg-*) return 1 ;; # debian dpkg
 
131
      README*)  return 1 ;; # documentation
134
132
    esac
135
133
  else
136
134
    return 1
188
186
  done
189
187
  echo "$a"
190
188
}
 
189
 
 
190
gettext_quoted () {
 
191
  $gettext "$@" | sed "s/'/'\\\\''/g"
 
192
}
 
193
 
 
194
uses_abstraction () {
 
195
  device=$1
 
196
 
 
197
  abstraction="`${grub_probe} --device ${device} --target=abstraction`"
 
198
  for module in ${abstraction}; do
 
199
    if test "x${module}" = "x$2"; then
 
200
      return 0
 
201
    fi
 
202
  done
 
203
  return 1
 
204
}