On Sun, 2014-11-23 at 16:23 +0100, Cyril Brulebois wrote:
> Michael Weiser <m.wei...@science-computing.de> (2014-11-11):
> > >From 333151e5eed04e7ef292bb15109131e731092674 Mon Sep 17 00:00:00 2001
> > From: Michael Weiser <m.wei...@science-computing.de>
> > Date: Tue, 11 Nov 2014 16:59:05 +0100
> > Subject: [PATCH] Allow for devices with multiple enumeration characters
> > 
> > Allow for installation of grub on devices such as /dev/sdaa or
> > /dev/xvdab.
> > ---
> >  grub-installer | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/grub-installer b/grub-installer
> > index 2b61fb6..cce326f 100755
> > --- a/grub-installer
> > +++ b/grub-installer
> > @@ -252,7 +252,7 @@ case $prefix in
> >      /dev/mapper)
> >     disc_offered_devfs="$bootfs"
> >     ;;
> > -    
> > /dev/[hsv]d[a-z0-9]|/dev/xvd[a-z]|/dev/cciss/c[0-9]d[0-9]*|/dev/ida/c[0-9]d[0-9]*|/dev/rs/c[0-9]d[0-9]*|/dev/mmcblk[0-9]|/dev/ad[0-9]*|/dev/da[0-9]*)
> > +    
> > /dev/[hsv]d[a-z0-9]|/dev/[sv]d[a-z][a-z]*|/dev/xvd[a-z]*|/dev/cciss/c[0-9]d[0-9]*|/dev/ida/c[0-9]d[0-9]*|/dev/rs/c[0-9]d[0-9]*|/dev/mmcblk[0-9]|/dev/ad[0-9]*|/dev/da[0-9]*)
> >     disc_offered_devfs="$prefix"
> >     ;;
> >      *)
> 
> Hi Ben,
> 
> could you please double check the above patch? I'd like another pair
> of eyes on it before possibly merging it.

device_to_disk already knows how to do the mapping.  We have this
complicated wildcard here which doesn't match the regexp in
device_to_disk, only because no-one got round to clearing out the devfs
cruft which is the following '*' case.

So I propose this instead:

Subject: Remove devfs case for mapping partitions to whole disk names
 (Closes: #769107)

Rather than using an unmaintainable wildcard for non-devfs
partition device names, we should remove the obsolete devfs
case and use device_to_disk by default.

Also remove one of the many pointless uses of mapdevfs.
---
 grub-installer | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/grub-installer b/grub-installer
index bff4174..9059638 100755
--- a/grub-installer
+++ b/grub-installer
@@ -247,19 +247,15 @@ prefix=$(device_to_disk "$bootfs")
 
 case $prefix in
     /dev/md)
-       disc_offered_devfs="$bootfs"
+       disc_offered="$bootfs"
        ;;
     /dev/mapper)
-       disc_offered_devfs="$bootfs"
-       ;;
-    
/dev/[hsv]d[a-z0-9]|/dev/xvd[a-z]|/dev/cciss/c[0-9]d[0-9]*|/dev/ida/c[0-9]d[0-9]*|/dev/rs/c[0-9]d[0-9]*|/dev/mmcblk[0-9]|/dev/ad[0-9]*|/dev/da[0-9]*)
-       disc_offered_devfs="$prefix"
+       disc_offered="$bootfs"
        ;;
     *)
-       disc_offered_devfs=$(echo "$bootfs_nodevfs" | sed 
"s:\(.*\)/.*:\1/disc:")
+       disc_offered="$prefix"
        ;;
 esac
-disc_offered=$(mapdevfs "$disc_offered_devfs")
 
 # Identify partition table of the disk containing our boot partition
 bootfslabel=$(partmap $disc_offered || echo unknown)
--- END ---

Ben.

-- 
Ben Hutchings
Absolutum obsoletum. (If it works, it's out of date.) - Stafford Beer

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to