summaryrefslogtreecommitdiffstats
path: root/scripts/launch-test-instance.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch)
treef87bd4a126b3a843858eb447e8fd5893c3ee3882 /scripts/launch-test-instance.sh
parentInitial commit. (diff)
downloadknot-resolver-upstream.tar.xz
knot-resolver-upstream.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/launch-test-instance.sh')
-rwxr-xr-xscripts/launch-test-instance.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/launch-test-instance.sh b/scripts/launch-test-instance.sh
new file mode 100755
index 0000000..8a93328
--- /dev/null
+++ b/scripts/launch-test-instance.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -e
+export PATH="/usr/lib/ccache:$PATH"
+
+PORT=${1:-$((32767+$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -d' ' -f1) % 32768))}
+
+JOBS=$(cat /proc/cpuinfo | grep processor | wc -l)
+
+WORKDIR=${2:-$(mktemp -d /tmp/knot-resolver.XXXXXX)}
+
+PREFIX=${PREFIX:-$WORKDIR} make clean
+
+CFLAGS=${CFLAGS:-"-O2 -g3"} PREFIX=${PREFIX:-$WORKDIR} make -j ${JOBS} V=1
+
+PREFIX=${PREFIX:-$WORKDIR} make install
+
+install -d -m 0700 ${WORKDIR}/run/kresd
+
+echo "Launching Knot Resolver on port: ${PORT}"
+echo "To debug, use:"
+echo "dig +dnssec +multi +time=60 +retry=1 -p ${PORT} @::1"
+
+LD_LIBRARY_PATH=${WORKDIR}/lib ${WORKDIR}/sbin/kresd -a 127.0.0.1#${PORT} -a ::1#${PORT} -v -k ${ROOT_KEY:-/usr/share/dns/root.key} ${WORKDIR}/run/kresd
+
+if [ "${WORKDIR}" != "${2}" -a "${KEEP_WORKDIR}" != "yes" ]; then
+ rm -r ${WORKDIR}
+fi