/[fai]/trunk/bin/device2grub
ViewVC logotype

Contents of /trunk/bin/device2grub

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4308 - (show annotations) (download)
Mon Jun 11 12:27:23 2007 UTC (5 years, 11 months ago) by lange
File size: 786 byte(s)
fix pattern to support /dev/cciss and /dev/ida devices (closes: #416381)
1 #! /usr/bin/perl
2 # copyright Thomas Lange 2001-2007, lange@debian.org
3 # map "normal" device notation to grub notation
4
5 # TODO: read from stdin if no parameter given
6
7 use strict;
8 my $grubdevice;
9 my %map;
10
11 my $device=shift;
12 my $devicemap="$ENV{target}/boot/grub/device.map";
13
14 open (DEVICEMAP,"<$devicemap") || die "Can't open $devicemap\n";
15 while (<DEVICEMAP>) {
16 my ($grubdevice,$olddevice) = split;
17 $map{$olddevice} = $grubdevice;
18 }
19
20 $device=~ m#^(/dev/(?:[sh]d\D|ida/c\d*d\d*|cciss/c\d*d\d*))p*(\d*)$# || die "Can't match device: $device\n";
21 my ($disk,$partition) = ($1,$2);
22
23 if ($map{$disk}) {
24 $grubdevice=$map{$disk};
25 } else {
26 die "No match in $devicemap for $disk\n";
27 }
28
29 if ($partition) {
30 $partition--;
31 $grubdevice=~s/\)/,$partition\)/;
32 }
33
34 print "$grubdevice\n";
35 exit 0;

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5