#!/bin/bash if [ "$1" == 'debug' ]; then set -x; _DEBUG=$1; shift; fi if [ "$1" == 'debug2' ]; then set -xvT; _DEBUG=$1; shift; fi if [ "$1" == 'trace' ]; then _TRACE=$1; shift; fi OUTFILE=filter STAMP="`date --iso=seconds`" STATE="$1" echo "# # Do NOT edit this file as it is generated every time the module starts # and provides the 'filter' function #" > $OUTFILE echo "filter() {" >> $OUTFILE echo ": FILTER_STATE=$STATE" >> $OUTFILE echo ": FILTER_DATE=$STAMP" >> $OUTFILE : echo "[${FUNCNAME[0]}]" >> $OUTFILE ALLFILTERS=`echo rules/*.rule | sort -n` for f in $ALLFILTERS do cat $f >> $OUTFILE done echo "RULE=NO_RULE_MATCH" >> $OUTFILE echo "return 0" >> $OUTFILE echo "}" >> $OUTFILE