From 66ac9d138e92184889e79465fddf9f2751665d5d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 28 Jan 2009 10:55:55 +0100 Subject: [PATCH] add script to convert csv to dhcpd.conf Signed-off-by: Nico Schottelius --- linux/next-build.sh | 3 ++- mac-adresses-csv-to-dhcpd.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 mac-adresses-csv-to-dhcpd.sh diff --git a/linux/next-build.sh b/linux/next-build.sh index a53aac2..bb8ef2d 100755 --- a/linux/next-build.sh +++ b/linux/next-build.sh @@ -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 diff --git a/mac-adresses-csv-to-dhcpd.sh b/mac-adresses-csv-to-dhcpd.sh new file mode 100755 index 0000000..a5520ca --- /dev/null +++ b/mac-adresses-csv-to-dhcpd.sh @@ -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"