1# #-- zonemd_reload.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 7. ../common.sh 8get_random_port 2 9UNBOUND_PORT=$RND_PORT 10FWD_PORT=$(($RND_PORT + 1)) 11echo "UNBOUND_PORT=$UNBOUND_PORT" >> .tpkg.var.test 12echo "FWD_PORT=$FWD_PORT" >> .tpkg.var.test 13 14# start forwarder 15get_ldns_testns 16$LDNS_TESTNS -p $FWD_PORT zonemd_reload.testns >fwd.log 2>&1 & 17FWD_PID=$! 18echo "FWD_PID=$FWD_PID" >> .tpkg.var.test 19 20# make config file 21CONTROL_PATH=/tmp 22CONTROL_PID=$$ 23sed -e 's/@PORT\@/'$UNBOUND_PORT'/' -e 's/@TOPORT\@/'$FWD_PORT'/' -e 's?@CONTROL_PATH\@?'$CONTROL_PATH'?' -e 's/@CONTROL_PID@/'$CONTROL_PID'/' < zonemd_reload.conf > ub.conf 24# start unbound in the background 25PRE="../.." 26$PRE/unbound -d -c ub.conf >unbound.log 2>&1 & 27UNBOUND_PID=$! 28echo "UNBOUND_PID=$UNBOUND_PID" >> .tpkg.var.test 29echo "CONTROL_PATH=$CONTROL_PATH" >> .tpkg.var.test 30echo "CONTROL_PID=$CONTROL_PID" >> .tpkg.var.test 31 32cat .tpkg.var.test 33wait_ldns_testns_up fwd.log 34wait_unbound_up unbound.log 35 36