2009-01-28 09:55:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
sep=';'
|
|
|
|
name='dryad'
|
2009-01-28 10:19:20 +00:00
|
|
|
hostname="$1"; shift
|
|
|
|
ipnbase="$1"; shift
|
|
|
|
field="$1"; shift
|
|
|
|
file="$1"; shift
|
2009-01-28 09:55:55 +00:00
|
|
|
|
|
|
|
awk "-F$sep" 'BEGIN {
|
|
|
|
hc=1;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mac2dp(mac)
|
|
|
|
{
|
|
|
|
i=0;
|
|
|
|
newmac=""
|
|
|
|
while (i < 5) {
|
|
|
|
newmac = sprintf("%s%s:",newmac,substr(mac,(1+i*2),2));
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
newmac = sprintf("%s%s",newmac,substr(mac,(1+i*2),2));
|
|
|
|
return newmac;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/^S-09/
|
|
|
|
{
|
2009-01-28 10:19:20 +00:00
|
|
|
mac = mac2dp($field);
|
|
|
|
print \
|
|
|
|
" host " hostname hc " {\n" \
|
|
|
|
" hardware ethernet " mac ";\n" \
|
|
|
|
" fixed-address " ipnbase hc ";\n" \
|
|
|
|
" }";
|
2009-01-28 09:55:55 +00:00
|
|
|
hc++;
|
2009-01-28 10:19:20 +00:00
|
|
|
}' ipnbase="$ipnbase" field="$field" hostname="$hostname" < "$file"
|