[Fai-commit] r6296 - trunk/bin

Michael Goetze mgoetze-guest at alioth.debian.org
Tue Feb 15 18:13:56 UTC 2011


Author: mgoetze-guest
Date: 2011-02-15 18:13:25 +0000 (Tue, 15 Feb 2011)
New Revision: 6296

Modified:
   trunk/bin/device2grub
Log:
Make device2grub use grub-mkdevicemap rather than stuff in 

Modified: trunk/bin/device2grub
===================================================================
--- trunk/bin/device2grub	2011-02-15 11:07:01 UTC (rev 6295)
+++ trunk/bin/device2grub	2011-02-15 18:13:25 UTC (rev 6296)
@@ -2,6 +2,7 @@
 
 # $Id$
 # copyright Thomas Lange 2001-2010, lange at debian.org
+# copyright Michael Goetze 2011, mgoetze at mgoetze.net
 # map "normal" device notation to grub notation
 
 # TODO: read from stdin if no parameter given
@@ -14,10 +15,13 @@
 my %map;
 
 my $device=shift;
-my $devicemap="$ENV{target}/boot/grub/device.map";
+my $devicemap = `mktemp`;
+chomp $devicemap;
 my $devbyid = "/dev/disk/by-id";
 
-open (DEVICEMAP,"<$devicemap") || die "Can't open $devicemap\n";
+system("/usr/sbin/grub-mkdevicemap", "-m", "$devicemap") == 0 or die "Could not run grub-mkdevicemap\n";
+
+open (DEVICEMAP,"<$devicemap") || die "Can't open device map $devicemap\n";
 while (<DEVICEMAP>) {
   my ($grubdevice,$olddevice) = split;
   $map{$olddevice} = $grubdevice;
@@ -53,4 +57,5 @@
 }
 
 print "$grubdevice\n";
+unlink("$devicemap");
 exit 0;




More information about the Fai-commit mailing list