[Fai-commit] r6435 - branches/stable/3.4/bin
Michael Prokop
mika at alioth.debian.org
Fri Apr 15 18:11:36 UTC 2011
Author: mika
Date: 2011-04-15 18:11:20 +0000 (Fri, 15 Apr 2011)
New Revision: 6435
Modified:
branches/stable/3.4/bin/device2grub
Log:
Make device2grub use grub-mkdevicemap rather than stuff in target
(cherry picked from commit e07062616b837de2e9927253a2d65a43bfdb8f20)
Modified: branches/stable/3.4/bin/device2grub
===================================================================
--- branches/stable/3.4/bin/device2grub 2011-04-15 18:11:06 UTC (rev 6434)
+++ branches/stable/3.4/bin/device2grub 2011-04-15 18:11:20 UTC (rev 6435)
@@ -1,5 +1,6 @@
#! /usr/bin/perl
# 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
@@ -12,10 +13,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;
@@ -51,4 +55,5 @@
}
print "$grubdevice\n";
+unlink("$devicemap");
exit 0;
More information about the Fai-commit
mailing list