add script to convert csv to dhcpd.conf

Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
This commit is contained in:
Nico Schottelius 2009-01-28 10:55:55 +01:00
parent 4191aa7593
commit 66ac9d138e
2 changed files with 35 additions and 1 deletions

View File

@ -20,6 +20,7 @@
builddir="$HOME/build/linux-next"
date="$(date +%Y%m%d)"
name="next-$date"
# comment out on single cpu systems
parallel="-j8"
@ -31,7 +32,7 @@ parallel="-j8"
# update / change branch
git-fetch
git-checkout -b "next-${date}" "origin/master"
git-checkout -b "$name" "$name"
# clean
make $parallel clean

33
mac-adresses-csv-to-dhcpd.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
file="$1"
sep=';'
name='dryad'
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/
{
mac = mac2dp($2)
print " host dryad" hc \
" {\n hardware ethernet " mac
";\n fixed-address 192.168.54."
i
";\n }";
hc++;
}' < "$1"