Re: using fai-chboot with mac-address
Hi Torge, On Sat, 29 May 2010 18:06:02 +0200, Michael Tautschnig m...@debian.org wrote: I think it's just that nobody requested it before. But it should be pretty straight forward to come up with a patch: Just check for : in the hostname and handle this accordingly in the host2hex function of fai-chboot. Best, Michael Yes, I think so ;-) Here is a small patch I have written yesterday; [...] Thanks a lot for quickly providing a patch. I've slightly adapted your patch and dropped the part where a hostname of exactly 12 xdigits is also taken as a mac address - in my opinion it should be acceptable to use : or - as separators to ensure there is no confusion (12 xdigits could well be a valid hostname). I've also updated the man page. @Holger: I think the match as done should be fine (/^([[:xdigit:]]{2}[:-]){5}[[:xdigit:]]{2}$/), no way to confuse this with IPv6 addresses. But thanks for spotting the possible problem, it made me take extra care! The patch is included in FAI 3.4~beta1+experimental25. Testing is much appreciated!!! Best, Michael pgpkleghAEC7H.pgp Description: PGP signature
Re: using fai-chboot with mac-address
On Sat, 29 May 2010 18:06:02 +0200, Michael Tautschnig m...@debian.org wrote: I think it's just that nobody requested it before. But it should be pretty straight forward to come up with a patch: Just check for : in the hostname and handle this accordingly in the host2hex function of fai-chboot. Best, Michael Yes, I think so ;-) Here is a small patch I have written yesterday; #--- sub host2hex { my $host = shift; if ($host =~ /^\d+\.\d+\.\d+\.\d+$/) { # hostname is already an IP address return ip2hex($host); } return ('no IP','default') if ($host =~ /^default/); # - - - Mac-Adresse als Host if ($host =~ /^([0-9a-fA-F]{2}([:-]|$)){6}$/i) { # Pattern-Matching Mac-Address with Seperators - or : $host = lc $host; # Lowercase for pxe-file my @nums = split /[:-]/, $host; $mac = 01-$nums[0]-$nums[1]-$nums[2]-$nums[3]-$nums[4]-$nums[5]; # build pxe-filename return $mac; }; if ($host =~ /^[0-9a-fA-F]{12}$/i) { # Pattern-Matching Mac-Address w/o Seperators $host = lc $host; my @nums = split /(.{2})/, $host; $mac = 01-$nums[1]-$nums[3]-$nums[5]-$nums[7]-$nums[9]-$nums[11]; # build pxe-filename return $mac; }; my $h = gethost($host); die $0: unknown host: $host\n unless $h; if ( @{$h-addr_list} 1 ) { my $i; for my $addr ( @{$h-addr_list} ) { $ipadr = inet_ntoa($addr); printf $host \taddr #%d is [%s]\n, $i++, $ipadr if $debug; } } else { $ipadr = inet_ntoa($h-addr); printf $host \taddress is [%s]\n, $ipadr if $debug; } ip2hex($ipadr); } # Perhaps it is useful for one or the other, in the future. Regards, Torge
Re: using fai-chboot with mac-address
Hi! Is there any good reason for this, that it is not possible to initiate installations based on the MAC address? Like making an output-file 01-00-11-22-33-44-55 from fai-chboot -IBv 00:11:22:33:44:55 ?? Is this a design decision or did it simply needed no one? I think it's just that nobody requested it before. But it should be pretty straight forward to come up with a patch: Just check for : in the hostname and handle this accordingly in the host2hex function of fai-chboot. Best, Michael pgptHHjQKYyFB.pgp Description: PGP signature