From: aquarius Date: Sat, 12 May 2012 18:15:42 +0000 (+0000) Subject: Major overhaul of make-pimp; runtime decreased by 2 orders of magnitude :) X-Git-Url: http://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=commitdiff_plain;h=3947b122fd2375e9eeb6c5276faeab61cdcc6e56 Major overhaul of make-pimp; runtime decreased by 2 orders of magnitude :) git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@166 251d49ef-1d17-4917-a970-b30cf55b089b --- diff --git a/optional-tools/make-pimp b/optional-tools/make-pimp index fd58569..8bc77a0 100755 --- a/optional-tools/make-pimp +++ b/optional-tools/make-pimp @@ -1,30 +1,15 @@ #!/bin/bash +# $Id$ pimp_2way_nat="/dev/shm/pimp-2way-nat.tmp" pimp_snat="/dev/shm/pimp-snat.tmp" etchosts="/mnt/mtdblock0/hosts" echo -n "Writing $pimp_2way_nat" echo "#This file was generated by Prometheus-tools/make-pimp" > $pimp_2way_nat -for czfip in `grep -v ^# $etchosts|grep [[]|cut -f 1` -do - pubip=`grep "^$czfip " $etchosts|cut -f 2 -d "["|cut -f 1 -d "]"` - if ! [ -z $pubip ] - then - echo "$czfip $pubip" >> $pimp_2way_nat - echo -n . - fi -done +sed -e '/^#/d; /^$/d; /.*\[.*\]/!d; s/[ \t].*#.*\[/ /; s/\].*$//' < $etchosts >> $pimp_2way_nat echo " done." echo -n "Writing $pimp_snat" echo "#This file was generated by Prometheus-tools/make-pimp" > $pimp_snat -for czfip in `grep -v ^# $etchosts|grep "("|cut -f 1` -do - pubip=`grep "^$czfip " $etchosts|cut -f 2 -d "("|cut -f 1 -d ")"` - if ! [ -z "$pubip" ] - then - echo "$czfip $pubip" >> $pimp_snat - echo -n . - fi -done +sed -e '/^#/d; /^$/d; /.*(.*)/!d; s/[ \t].*#.*(/ /; s/).*$//' < $etchosts >> $pimp_snat echo " done."