Commit 05677dc7 authored by Marc Elser's avatar Marc Elser Committed by Jan Pavlinec

knot-resolver: modify init script to properly use rundir in /etc/config/resolver

Signed-off-by: Jan Pavlinec's avatarJan Pavlinec <jan.pavlinec@nic.cz>
parent 442fd837
......@@ -8,7 +8,6 @@ PROG=/usr/bin/kresd
CONFIGFILE=/tmp/kresd.config
ROOTKEYFILE=/etc/root.keys
DEFAULT_RUNDIR=/tmp/kresd
HINTS_CONFIG=$DEFAULT_RUNDIR/hints.tmp
STATIC_DOMAINS=1
DYNAMIC_DOMAINS=0
......@@ -190,8 +189,19 @@ add_hostname_config() {
fi
}
modify_rundir() {
local rundir
local section="kresd"
# rundir
config_get rundir "$section" rundir "$DEFAULT_RUNDIR"
[ ! -d "$rundir" ] && mkdir -p "$rundir"
DEFAULT_RUNDIR="$rundir"
HINTS_CONFIG=$DEFAULT_RUNDIR/hints.tmp
}
load_uci_config_kresd() {
local addr config keyfile forks verbose rundir log_stderr log_stdout hostname_config
local addr config keyfile forks verbose log_stderr log_stdout hostname_config
local section="kresd"
# knot-resolver config
......@@ -202,9 +212,7 @@ load_uci_config_kresd() {
procd_append_param command -f "$forks"
# rundir
config_get rundir "$section" rundir "$DEFAULT_RUNDIR"
[ ! -d "$rundir" ] && mkdir -p "$rundir"
procd_append_param command "$rundir"
procd_append_param command "$DEFAULT_RUNDIR"
# procd stdout/err logging
config_get_bool log_stderr "$section" log_stderr 1
......@@ -236,6 +244,7 @@ run_instance() {
procd_open_instance
procd_set_param file /etc/config/resolver
procd_set_param command "$PROG"
modify_rundir
init_header
load_uci_config_kresd
load_uci_config_common
......@@ -244,7 +253,7 @@ run_instance() {
if ! ip -6 r s | grep -q '^default' &&\
ping -c 1 api.turris.cz > /dev/null 2>&1 && \
! ping -6 -c 1 api.turris.cz > /dev/null 2>&1; then
echo "net.ipv6 = false" | socat - UNIX-CONNECT:$(sleep 5; ls -1 /tmp/kresd/tty/*) > /dev/null 2>&1
echo "net.ipv6 = false" | socat - UNIX-CONNECT:$(sleep 5; ls -1 $DEFAULT_RUNDIR/tty/*) > /dev/null 2>&1
fi) &
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment