1# #-- pymod_thread.pre--# 2# source the master var file when it's there 3[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master 4# use .tpkg.var.test for in test variable passing 5[ -f .tpkg.var.test ] && source .tpkg.var.test 6 7PRE="../.." 8. ../common.sh 9# if no python; exit 10if grep "define WITH_PYTHONMODULE 1" $PRE/config.h; then 11 echo "have python module" 12else 13 echo "no python module" 14 exit 0 15fi 16# get module python local 17cp $PRE/pythonmod/unboundmodule.py . 18 19if test "`uname 2>&1`" = "Darwin"; then 20 ldnsdir=`grep ldnsdir= ../../Makefile | sed -e 's/ldnsdir=//'` 21 echo export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs" 22 export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ldnsdir/lib:../../.libs" 23fi 24 25get_random_port 2 26UNBOUND_PORT=$RND_PORT 27FWD_PORT=$(($RND_PORT + 1)) 28echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test 29echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test 30 31# make config file 32sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' < pymod_thread.conf > ub.conf 33 34# see if config file verifies 35if $PRE/unbound-checkconf ub.conf 2>&1; then 36 echo "checkconf OK" 37else 38 echo "checkconf failed" 39 exit 1 40fi 41 42# start forwarder 43get_ldns_testns 44$LDNS_TESTNS -p $FWD_PORT pymod_thread.testns >fwd.log 2>&1 & 45FWD_PID=$! 46echo "FWD_PID=$FWD_PID" >> .tpkg.var.test 47 48# start unbound in the background 49$PRE/unbound -d -c ub.conf >unbound.log 2>&1 & 50UNBOUND_PID=$! 51echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test 52 53cat .tpkg.var.test 54wait_ldns_testns_up fwd.log 55wait_unbound_up unbound.log 56 57