~ubuntu-branches/debian/jessie/grub/jessie

« back to all changes in this revision

Viewing changes to debian/patches/use_grub-probe_in_grub-install.diff

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-03-17 13:34:14 UTC
  • Revision ID: james.westby@ubuntu.com-20110317133414-cawa48d482iuqqb9
Tags: 0.97-65
* Fix grub/migrate_from_legacy title to not end with a full stop.
* Fix update-grub(8) groff typo (".bar" instead of ".br").
* Adjust doc-base file to account for renaming of grub.info to
  grub-legacy.info.
* Compare -trunk kernels earlier than numeric ABIs (thanks, Aaron M. Ucko
  and Andreas Beckmann; closes: #570318).
* Convert from home-grown patch system to quilt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -ur grub-0.97/util/grub-install.in grub-0.97.raid/util/grub-install.in
2
 
--- grub-0.97/util/grub-install.in      2008-04-30 22:42:03.000000000 +0200
3
 
+++ grub-0.97.raid/util/grub-install.in 2008-04-30 22:46:45.000000000 +0200
4
 
@@ -137,106 +137,12 @@
5
 
        exit 1
6
 
     fi
7
 
 
8
 
-    # Break the device name into the disk part and the partition part.
9
 
-    case "$host_os" in
10
 
-    linux*)
11
 
        # Find an actual physical device if we're passed a RAID device
12
 
        case $1 in
13
 
-               /dev/md*)  set -- `getraid_mdadm $1`
14
 
+               /dev/md* | /dev/md/*)  set -- `getraid_mdadm $1`
15
 
        esac
16
 
-       tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
17
 
-                                 -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
18
 
-                                 -e 's%\(fd[0-9]*\)$%\1%' \
19
 
-                                 -e 's%/part[0-9]*$%/disc%' \
20
 
-                                 -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
21
 
-                                 -e 's%\(e[0-9]\.[0-9]*\).*$%\1%'`
22
 
-       tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]\([0-9]*\)$%\1%' \
23
 
-                                 -e 's%.*d[0-9]*p%%' \
24
 
-                                 -e 's%.*/fd[0-9]*$%%' \
25
 
-                                 -e 's%.*/floppy/[0-9]*$%%' \
26
 
-                                 -e 's%.*/\(disc\|part\([0-9]*\)\)$%\2%' \
27
 
-                                 -e 's%.*c[0-7]d[0-9]*p*%%' \
28
 
-                                 -e 's%.*e[0-9]\.[0-9]*p%%' \
29
 
-                                 -e 's%.*e[0-9]\.[0-9]*\$%%'`
30
 
-       ;;
31
 
-    gnu*)
32
 
-       tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
33
 
-       tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;;
34
 
-    freebsd* | kfreebsd*-gnu)
35
 
-       tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%\1%' \
36
 
-                           | sed 's%r\{0,1\}\(da[0-9]*\).*$%\1%'`
37
 
-       tmp_part=`echo "$1" \
38
 
-           | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \
39
 
-                   | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"`
40
 
-       ;;
41
 
-    netbsd* | knetbsd*-gnu)
42
 
-       tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([sw]d[0-9]*\).*$%r\1d%' \
43
 
-           | sed 's%r\{0,1\}\(fd[0-9]*\).*$%r\1a%'`
44
 
-       tmp_part=`echo "$1" \
45
 
-           | sed "s%.*/r\{0,1\}[sw]d[0-9]\([abe-p]\)%\1%"`
46
 
-       ;;
47
 
-    *)
48
 
-       echo "grub-install does not support your OS yet." 1>&2
49
 
-       exit 1 ;;
50
 
-    esac
51
 
 
52
 
-    # Get the drive name.
53
 
-    tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \
54
 
-       | sed 's%.*\(([hf]d[0-9][a-z0-9,]*)\).*%\1%'`
55
 
-
56
 
-    # If not found, print an error message and exit.
57
 
-    if test "x$tmp_drive" = x; then
58
 
-       echo "$1 does not have any corresponding BIOS drive." 1>&2
59
 
-       exit 1
60
 
-    fi
61
 
-
62
 
-    if test "x$tmp_part" != x; then
63
 
-       # If a partition is specified, we need to translate it into the
64
 
-       # GRUB's syntax.
65
 
-       case "$host_os" in
66
 
-       linux*)
67
 
-           echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;;
68
 
-       gnu*)
69
 
-           if echo $tmp_part | grep "^s" >/dev/null; then
70
 
-               tmp_pc_slice=`echo $tmp_part \
71
 
-                   | sed "s%s\([0-9]*\)[a-z]*$%\1%"`
72
 
-               tmp_drive=`echo "$tmp_drive" \
73
 
-                   | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
74
 
-           fi
75
 
-           if echo $tmp_part | grep "[a-z]$" >/dev/null; then
76
 
-               tmp_bsd_partition=`echo "$tmp_part" \
77
 
-                   | sed "s%[^a-z]*\([a-z]\)$%\1%"`
78
 
-               tmp_drive=`echo "$tmp_drive" \
79
 
-                   | sed "s%)%,$tmp_bsd_partition)%"`
80
 
-           fi
81
 
-           echo "$tmp_drive" ;;
82
 
-       freebsd* | kfreebsd*-gnu)
83
 
-           if echo $tmp_part | grep "^s" >/dev/null; then
84
 
-               tmp_pc_slice=`echo $tmp_part \
85
 
-                   | sed "s%s\([0-9]*\)[a-h]*$%\1%"`
86
 
-               tmp_drive=`echo "$tmp_drive" \
87
 
-                   | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
88
 
-           fi
89
 
-           if echo $tmp_part | grep "[a-h]$" >/dev/null; then
90
 
-               tmp_bsd_partition=`echo "$tmp_part" \
91
 
-                   | sed "s%s\{0,1\}[0-9]*\([a-h]\)$%\1%"`
92
 
-               tmp_drive=`echo "$tmp_drive" \
93
 
-                   | sed "s%)%,$tmp_bsd_partition)%"`
94
 
-           fi
95
 
-           echo "$tmp_drive" ;;
96
 
-       netbsd* | knetbsd*-gnu)
97
 
-           if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then
98
 
-               tmp_bsd_partition=`echo "$tmp_part" \
99
 
-                   | sed "s%\([a-p]\)$%\1%"`
100
 
-               tmp_drive=`echo "$tmp_drive" \
101
 
-                   | sed "s%)%,$tmp_bsd_partition)%"`
102
 
-           fi
103
 
-           echo "$tmp_drive" ;;
104
 
-       esac
105
 
-    else
106
 
-       # If no partition is specified, just print the drive name.
107
 
-       echo "$tmp_drive"
108
 
-    fi
109
 
+       GRUB_LEGACY_0_BASED_PARTITIONS=1 grub-probe --device-map=${device_map} -t drive -d "$1"
110
 
 }
111
 
 
112
 
 # Usage: resolve_symlink file
113
 
@@ -265,9 +171,7 @@
114
 
 # Usage: find_device file
115
 
 # Find block device on which the file resides.
116
 
 find_device () {
117
 
-    # For now, this uses the program `df' to get the device name, but is
118
 
-    # this really portable?
119
 
-    tmp_fname=`df $1/ | sed -n 's%.*\(/dev/[^  ]*\).*%\1%p'`
120
 
+    tmp_fname=`grub-probe --device-map=${device_map} -t device $1/`
121
 
 
122
 
     if test -z "$tmp_fname"; then
123
 
        echo "Could not find device for $1" 2>&1
124
 
diff -ur grub-0.97/util/grub-install.in grub-0.97.new/util/grub-install.in
125
 
--- grub-0.97/util/grub-install.in      2008-07-23 01:14:29.000000000 +0200
126
 
+++ grub-0.97.new/util/grub-install.in  2008-07-23 01:16:46.000000000 +0200
127
 
@@ -288,22 +288,7 @@
128
 
 if test -f "$device_map"; then
129
 
     :
130
 
 else
131
 
-    # Create a safe temporary file.
132
 
-    test -n "$mklog" && log_file=`$mklog`
133
 
-
134
 
-    # Before all invocations of the grub shell, call sync to make sure
135
 
-    # the raw device is in sync with any bufferring in filesystems.
136
 
-    sync
137
 
138
 
-    $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
139
 
-quit
140
 
-EOF
141
 
-    if grep "Error [0-9]*: " $log_file >/dev/null; then
142
 
-       cat $log_file 1>&2
143
 
-       exit 1
144
 
-    fi
145
 
-
146
 
-    rm -f $log_file
147
 
+    grub-mkdevicemap $no_floppy --device-map=$device_map
148
 
 fi
149
 
 
150
 
 # Make sure that there is no duplicated entry.