allow command line parameter, some cleanup

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
Nico Schottelius 2009-01-28 11:19:20 +01:00
parent 66ac9d138e
commit 12f3e1e371
1 changed files with 11 additions and 8 deletions

View File

@ -1,8 +1,11 @@
#!/bin/sh
file="$1"
sep=';'
name='dryad'
hostname="$1"; shift
ipnbase="$1"; shift
field="$1"; shift
file="$1"; shift
awk "-F$sep" 'BEGIN {
hc=1;
@ -23,11 +26,11 @@ awk "-F$sep" 'BEGIN {
/^S-09/
{
mac = mac2dp($2)
print " host dryad" hc \
" {\n hardware ethernet " mac
";\n fixed-address 192.168.54."
i
";\n }";
mac = mac2dp($field);
print \
" host " hostname hc " {\n" \
" hardware ethernet " mac ";\n" \
" fixed-address " ipnbase hc ";\n" \
" }";
hc++;
}' < "$1"
}' ipnbase="$ipnbase" field="$field" hostname="$hostname" < "$file"