3 # Quick hack to convert /etc/bootptab to format required by ISC DHCPD
4 # This only outputs the fixed hosts portion of the config file
5 # You still have to provide the global options and the subnet scoping
7 # Turn $useipaddr on if you prefer to use IP addresses in the config file
8 # I run DNS so I prefer domain names
10 # This will be appended to get the FQDN unless the hostname is already FQDN
11 $domainname = "ken.com.au";
12 $tftpdir = "/tftpdir/";
13 open(B
, "/etc/bootptab") or die "/etc/bootptab: $!\n";
20 ($hostname, @tags) = split(/:/, $_, 5);
21 ($fqdn = $hostname) .= ".$domainname" unless($hostname =~ /\./);
22 ($macaddr) = grep(/^ha=/, @tags);
24 $macaddr =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/g;
25 ($ipaddr) = grep(/^ip=/, @tags);
27 ($bootfile) = grep(/^bf=/, @tags);
29 $bootfile = $tftpdir . $bootfile;
30 # I have a comment line above most entries and I like to carry this over
31 print $prevline if ($prevline =~ /^#/);
32 $address = $useipaddr ?
$ipaddr : $fqdn;
35 hardware ethernet $macaddr;
36 fixed-address $address;