[Fai-commit] r5898 - in trunk: bin debian man

Thomas Lange lange at alioth.debian.org
Wed Jul 28 23:53:39 UTC 2010


Author: lange
Date: 2010-07-28 23:53:39 +0000 (Wed, 28 Jul 2010)
New Revision: 5898

Modified:
   trunk/bin/fai-chboot
   trunk/debian/changelog
   trunk/man/fai-chboot.8
Log:
fai-chboot, fai-chboot.8: support for MAC address, same as host name
(thanks to Torge Gipp for the initial patch)

Modified: trunk/bin/fai-chboot
===================================================================
--- trunk/bin/fai-chboot	2010-07-28 21:56:45 UTC (rev 5897)
+++ trunk/bin/fai-chboot	2010-07-28 23:53:39 UTC (rev 5898)
@@ -56,6 +56,21 @@
   }
   return ('no IP','default') if ($host =~ /^default/);
 
+  # MAC address with separator "-" or ":"
+  if ($host =~ /^([0-9a-fA-F]{2}([:-]|$)){6}$/i) { # pattern matching
+    $host = lc $host; # lowercase for pxe-file
+    my @nums = split /[:-]/, $host;
+    $mac = join ('-', "01", at nums); # build pxe-filename
+    return ('no IP',$mac);
+  }
+
+  if ($host =~ /^[0-9a-fA-F]{12}$/i) { # pattern matching MAC address w/o separator
+    $host = lc $host;
+    my @nums = split /(.{2})/, $host;
+    $mac = join ('-', "01", at nums[1,3,5,7,9,11]); # build pxe-filename
+    return ('no IP',$mac);
+  }
+
   my $h = gethost($host);
   die "$0: unknown host: $host\n" unless $h;
 
@@ -133,7 +148,12 @@
       $type = '[Template]';
     }
 
-    if ($hex =~ /^[0-9A-F]+/) {
+    if ($hex =~ /^01-[0-9A-F-]{17}$/i) {
+      $host = "$hex";
+      $type = '[MAC address]';
+    }
+
+    if (($hex =~ /^[0-9A-F]+/) && ($hex !~ /^01-/) ) {
       my $hexstrip = (split /\./,$hex)[0]; # remove .disable if necessary
       $n = $hexstrip;
       # hex to ip/subnet address
@@ -210,7 +230,7 @@
     $append =~ /FAI_ACTION=(\S+)/;
     $append = $1;
 #   printf "%-16.16s $append $kernelname %-8s\n",$host,$hex;
-    printf "%-26.26s  %-20.20s $append $kernelname\n",$type?$type:$host,$hex;
+    printf "%-26.26s  %-22.22s $append $kernelname\n",$type?$type:$host,$hex;
   } else {
     printf "%s %s $kernelname $append\n",$type?$type:$host,$hex;
   }

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2010-07-28 21:56:45 UTC (rev 5897)
+++ trunk/debian/changelog	2010-07-28 23:53:39 UTC (rev 5898)
@@ -76,6 +76,8 @@
   * fai-cd.8: add option -G
   * grub.cfg, Makefile: add missing grub.cfg to package
   * fai-server.install: add missing grub.cfg
+  * fai-chboot, fai-chboot.8: support for MAC address, same as host name
+    (thanks to Torge Gipp for the initial patch)
     
   [ Michael Tautschnig ]
   * control: Move setup-storage to its own package (fai-setup-storage). Thanks

Modified: trunk/man/fai-chboot.8
===================================================================
--- trunk/man/fai-chboot.8	2010-07-28 21:56:45 UTC (rev 5897)
+++ trunk/man/fai-chboot.8	2010-07-28 23:53:39 UTC (rev 5898)
@@ -1,5 +1,5 @@
 .\"                                      Hey, EMACS: -*- nroff -*-
-.TH fai-chboot 8 "25 June 2010" "FAI 4"
+.TH fai-chboot 8 "28 July 2010" "FAI 4.0"
 .\"
 .\" File Name macro.  This used to be `.PN', for Path Name,
 .\" but Sun doesn't seem to like that very much.
@@ -39,8 +39,9 @@
 kernel will mount the root filesystem via NFS. You can add
 additional kernel parameters and define some FAI specific flags. For
 each host one configuration file is created. The file name of the
-configuration file is its IP address in upper case hexadecimal. HOST
-can be a host name, an IP address or the keyword "default".
+configuration file is its IP address in upper case hexadecimal or its
+MAC address with the prefix "01-". HOST
+can be a host name, an IP or a MAC address or the keyword "default".
 
 .SH OPTIONS
 .TP




More information about the Fai-commit mailing list