summaryrefslogtreecommitdiffstats
path: root/network/dnscrypt-proxy/rc.dnscrypt-proxy
diff options
context:
space:
mode:
author T3slider2017-07-17 01:46:41 +0200
committer Willy Sudiarto Raharjo2017-07-22 01:55:34 +0200
commit0ccaf099552cd827488169c78140c70722b2f180 (patch)
tree7e74a225406ae08e658637ec1ed809a677935407 /network/dnscrypt-proxy/rc.dnscrypt-proxy
parent5043bde2a4c2e88f8d10b39842c6076c582ab286 (diff)
downloadslackbuilds-0ccaf099552cd827488169c78140c70722b2f180.tar.gz
network/dnscrypt-proxy: Updated for version 1.9.5.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/dnscrypt-proxy/rc.dnscrypt-proxy')
-rw-r--r--network/dnscrypt-proxy/rc.dnscrypt-proxy94
1 files changed, 30 insertions, 64 deletions
diff --git a/network/dnscrypt-proxy/rc.dnscrypt-proxy b/network/dnscrypt-proxy/rc.dnscrypt-proxy
index 221df34842..fd747759d1 100644
--- a/network/dnscrypt-proxy/rc.dnscrypt-proxy
+++ b/network/dnscrypt-proxy/rc.dnscrypt-proxy
@@ -6,11 +6,16 @@ DAEMON="/usr/sbin/dnscrypt-proxy"
. $CONFIGFILE
start_instance() {
- if [ -z ${PIDFILE[$1]} ]; then
+ if [ ! -r ${DNSCRYPTCONFIG[$1]} ]; then
echo "No configuration for instance $1 found!"
return
fi
- if [ -r ${PIDFILE[$1]} ]; then
+ PIDFILE=$(grep -i "^[[:space:]]*PidFile[[:space:]]\+." ${DNSCRYPTCONFIG[$1]} | awk '{print $2}')
+ if [ -z ${PIDFILE} ]; then
+ echo "No PID configuration for instance $1 found!"
+ return
+ fi
+ if [ -r ${PIDFILE} ]; then
echo "dnscrypt-proxy (instance $1) already running!"
return
fi
@@ -31,87 +36,48 @@ start_instance() {
if [ ! -c ${CHROOTDIR[$1]}/dev/urandom ]; then
mknod -m 666 ${CHROOTDIR[$1]}/dev/urandom c 1 9
fi
+ if [ ! -c ${CHROOTDIR[$1]}/dev/random ]; then
+ mknod -m 666 ${CHROOTDIR[$1]}/dev/random c 1 8
+ fi
fi
fi
- OPTIONS="-d"
- if [ -n "${LOCALADDRESS[$1]}" ]; then
- OPTIONS="${OPTIONS} --local-address=${LOCALADDRESS[$1]}"
- fi
- if [ -n "${PIDFILE[$1]}" ]; then
- OPTIONS="${OPTIONS} --pidfile=${PIDFILE[$1]}"
- fi
- if [ -n "${USER[$1]}" ]; then
- OPTIONS="${OPTIONS} --user=${USER[$1]}"
- fi
- if [ -n "${RESOLVERNAME[$1]}" ]; then
- OPTIONS="${OPTIONS} --resolver-name=${RESOLVERNAME[$1]}"
- fi
- if [ -n "${RESOLVERSLIST[$1]}" ]; then
- OPTIONS="${OPTIONS} --resolvers-list=${RESOLVERSLIST[$1]}"
- fi
- if [ -z "${RESOLVERNAME[$1]}" ] && [ -n "${RESOLVERADDRESS[$1]}" ]; then
- OPTIONS="${OPTIONS} --resolver-address=${RESOLVERADDRESS[$1]}"
- fi
- if [ -z "${RESOLVERNAME[$1]}" ] && [ -n "${PROVIDERNAME[$1]}" ]; then
- OPTIONS="${OPTIONS} --provider-name=${PROVIDERNAME[$1]}"
- fi
- if [ -z "${RESOLVERNAME[$1]}" ] && [ -n "${PROVIDERKEY[$1]}" ]; then
- OPTIONS="${OPTIONS} --provider-key=${PROVIDERKEY[$1]}"
- fi
- if [ "${EPHEMERALKEYS[$1]}" == "yes" ]; then
- OPTIONS="${OPTIONS} --ephemeral-keys"
- fi
- if [ -n "${CLIENTKEY[$1]}" ]; then
- OPTIONS="${OPTIONS} --client-key=${CLIENTKEY[$1]}"
- fi
- if [ -n "${EDNSPAYLOADSIZE[$1]}" ]; then
- OPTIONS="${OPTIONS} --edns-payload-size=${EDNSPAYLOADSIZE[$1]}"
- fi
- if [ -n "${MAXACTIVEREQUESTS[$1]}" ]; then
- OPTIONS="${OPTIONS} --max-active-requests=${MAXACTIVEREQUESTS[$1]}"
- fi
- if [ "${TCPONLY[$1]}" == "yes" ]; then
- OPTIONS="${OPTIONS} --tcp-only"
- fi
- if [ -n "${PLUGINS[$1]}" ]; then
- for plugin in ${PLUGINS[$1]}
- do
- OPTIONS="${OPTIONS} --plugin=${plugin}"
- done
- fi
- if [ -n "${LOGLEVEL[$1]}" ]; then
- OPTIONS="${OPTIONS} --loglevel=${LOGLEVEL[$1]}"
- fi
- if [ -n "${LOGFILE[$1]}" ]; then
- OPTIONS="${OPTIONS} --logfile=${LOGFILE[$1]}"
- fi
- $DAEMON $OPTIONS
+ $DAEMON ${DNSCRYPTCONFIG[$1]}
}
stop_instance() {
- if [ -z ${PIDFILE[$1]} ]; then
+ if [ ! -r ${DNSCRYPTCONFIG[$1]} ]; then
echo "No configuration for instance $1 found!"
return
fi
- if [ ! -r ${PIDFILE[$1]} ]; then
+ PIDFILE=$(grep -i "^[[:space:]]*PidFile[[:space:]]\+." ${DNSCRYPTCONFIG[$1]} | awk '{print $2}')
+ if [ -z ${PIDFILE} ]; then
+ echo "No PID configuration for instance $1 found!"
+ return
+ fi
+ if [ ! -r ${PIDFILE} ]; then
echo "dnscrypt-proxy (instance $1) is not running!"
return
fi
echo "Stopping dnscrypt-proxy (instance $1)..."
- kill $(cat ${PIDFILE[$1]})
+ kill $(cat ${PIDFILE})
}
status_instance() {
- if [ -z ${PIDFILE[$1]} ]; then
+ if [ ! -r ${DNSCRYPTCONFIG[$1]} ]; then
echo "No configuration for instance $1 found!"
return
fi
- if [ ! -r ${PIDFILE[$1]} ]; then
+ PIDFILE=$(grep -i "^[[:space:]]*PidFile[[:space:]]\+." ${DNSCRYPTCONFIG[$1]} | awk '{print $2}')
+ if [ -z ${PIDFILE} ]; then
+ echo "No PID configuration for instance $1 found!"
+ return
+ fi
+ if [ ! -r ${PIDFILE} ]; then
echo "dnscrypt-proxy (instance $1) is not running."
return
fi
- PID=$(cat ${PIDFILE[$1]})
+ PID=$(cat ${PIDFILE})
if [ -z "$PID" ]; then
echo "PID file is empty! dnscrypt-proxy (instance $1) does not appear to be running, but there is a stale PID file."
elif kill -0 $PID ; then
@@ -122,21 +88,21 @@ status_instance() {
}
start() {
- for i in `/usr/bin/seq 0 $((${#PIDFILE[@]}-1))`
+ for i in `/usr/bin/seq 0 $((${#DNSCRYPTCONFIG[@]}-1))`
do
start_instance $i
done
}
stop() {
- for i in `/usr/bin/seq 0 $((${#PIDFILE[@]}-1))`
+ for i in `/usr/bin/seq 0 $((${#DNSCRYPTCONFIG[@]}-1))`
do
stop_instance $i
done
}
status() {
- for i in `/usr/bin/seq 0 $((${#PIDFILE[@]}-1))`
+ for i in `/usr/bin/seq 0 $((${#DNSCRYPTCONFIG[@]}-1))`
do
status_instance $i
done