aboutsummaryrefslogtreecommitdiffstats
path: root/dns
diff options
context:
space:
mode:
authorCarlo Strub <cs@FreeBSD.org>2015-09-15 06:29:08 +0800
committerCarlo Strub <cs@FreeBSD.org>2015-09-15 06:29:08 +0800
commite2068230422a0cbce5bb99667f3e19cc64b754fa (patch)
tree6a4cba24e1d0d5353f8c6816859dbb26d1af8e55 /dns
parente164717b4538a25820e1be31776badc40f6c7c87 (diff)
downloadfreebsd-ports-gnome-e2068230422a0cbce5bb99667f3e19cc64b754fa.tar.gz
freebsd-ports-gnome-e2068230422a0cbce5bb99667f3e19cc64b754fa.tar.zst
freebsd-ports-gnome-e2068230422a0cbce5bb99667f3e19cc64b754fa.zip
Add support for multiple service instances
PR: 195698 Submitted by: Igor <arabesc@bk.ru> Approved by: maintainer
Diffstat (limited to 'dns')
-rw-r--r--dns/dnscrypt-proxy/Makefile22
-rw-r--r--dns/dnscrypt-proxy/files/dnscrypt-proxy_multi.in71
-rw-r--r--dns/dnscrypt-proxy/files/pkg-message.in15
-rw-r--r--dns/dnscrypt-proxy/files/pkg-message_multi.in19
4 files changed, 112 insertions, 15 deletions
diff --git a/dns/dnscrypt-proxy/Makefile b/dns/dnscrypt-proxy/Makefile
index 503349825d72..20f7864346d8 100644
--- a/dns/dnscrypt-proxy/Makefile
+++ b/dns/dnscrypt-proxy/Makefile
@@ -3,7 +3,7 @@
PORTNAME= dnscrypt-proxy
PORTVERSION= 1.6.0
-PORTREVISION= 0
+PORTREVISION= 1
CATEGORIES= dns
MASTER_SITES= http://download.dnscrypt.org/dnscrypt-proxy/ \
http://www.dns-lab.com/downloads/dnscrypt-proxy/
@@ -19,9 +19,23 @@ LIB_DEPENDS= libsodium.so:${PORTSDIR}/security/libsodium
GNU_CONFIGURE= yes
USES= execinfo gmake
-SUB_FILES= pkg-message
-
+OPTIONS_DEFINE= DOCS
+OPTIONS_SINGLE= RCWHICH
+OPTIONS_SINGLE_RCWHICH= RCSINGLE RCMULTI
+RCWHICH_DESC= rc script to use:
+RCSINGLE_DESC= use default rc script for single daemon
+RCMULTI_DESC= use experimental rc script for multiple instances
+OPTIONS_DEFAULT=RCSINGLE
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MRCMULTI}
+USE_RC_SUBR= ${PORTNAME}_multi
+SUB_FILES= pkg-message_multi
+.else
USE_RC_SUBR= ${PORTNAME}
+SUB_FILES= pkg-message
+.endif
USERS= _dnscrypt-proxy
@@ -29,8 +43,6 @@ PORTDOCS= AUTHORS ChangeLog INSTALL NEWS README \
README-PLUGINS.markdown README-WINDOWS.markdown \
README.markdown TECHNOTES THANKS
-OPTIONS_DEFINE= DOCS
-
post-install:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}
diff --git a/dns/dnscrypt-proxy/files/dnscrypt-proxy_multi.in b/dns/dnscrypt-proxy/files/dnscrypt-proxy_multi.in
new file mode 100644
index 000000000000..7b5c7d6af861
--- /dev/null
+++ b/dns/dnscrypt-proxy/files/dnscrypt-proxy_multi.in
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# $FreeBSD: $
+#
+# PROVIDE: dnscrypt_proxy
+# REQUIRE: SERVERS cleanvar
+# BEFORE: named local_unbound unbound
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable dnscrypt-proxy:
+#
+# dnscrypt_proxy_instances (str): Set to "dnscrypt_proxy" by default.
+# List of dnscrypt_proxy instance id's,
+# e.g. "dnscrypt_proxy_1 dnscrypt_proxy_2", etc.
+# {instance_id}_enable (bool): Set to NO by default.
+# Set to YES to enable dnscrypt-proxy.
+# {instance_id}_uid (str): Set to "_dnscrypt-proxy" by default.
+# User to switch to after starting.
+# {instance_id}_resolver (str): Set to "opendns" by default.
+# Choose a different upstream resolver.
+# {instance_id}_pidfile (str): default: "/var/run/dnscrypt-proxy.pid"
+# Location of pid file.
+# {instance_id}_logfile (str): default: "/var/log/dnscrypt-proxy.log"
+# Location of log file.
+#
+# To redirect a local resolver through dnscrypt-proxy, point it at 127.0.0.2
+# and add the following to rc.conf:
+# ifconfig_lo0_alias0="inet 127.0.0.2 netmask 0xffffffff"
+# dnscrypt_proxy_flags='-a 127.0.0.2'
+
+. /etc/rc.subr
+
+name=dnscrypt_proxy
+rcvar=dnscrypt_proxy_enable
+
+load_rc_config ${name}
+
+: ${dnscrypt_proxy_instances="${name}"}
+: ${dnscrypt_proxy_enable:=NO}
+
+dnscrypt_proxy_enable_tmp=${dnscrypt_proxy_enable}
+
+command=%%PREFIX%%/sbin/dnscrypt-proxy
+procname=%%PREFIX%%/sbin/dnscrypt-proxy
+
+for i in $dnscrypt_proxy_instances; do
+ name=${i}
+
+ eval ${name}_enable=${dnscrypt_proxy_enable_tmp}
+ rcvar=${name}_enable
+
+ load_rc_config ${i}
+
+ eval dnscrypt_proxy_uid_tmp=\${${i}_uid}
+ eval dnscrypt_proxy_resolver_tmp=\${${i}_resolver}
+ eval dnscrypt_proxy_pidfile_tmp=\${${i}_pidfile}
+ eval dnscrypt_proxy_logfile_tmp=\${${i}_logfile}
+
+: ${dnscrypt_proxy_uid_tmp:=_dnscrypt-proxy} # User to run daemon as
+: ${dnscrypt_proxy_resolver_tmp:=opendns} # resolver to use
+: ${dnscrypt_proxy_pidfile_tmp:=/var/run/${i}.pid} # Path to pid file
+: ${dnscrypt_proxy_logfile_tmp:=/var/log/${i}.log} # Path to log file
+
+ command_args="-d -p ${dnscrypt_proxy_pidfile_tmp} -l ${dnscrypt_proxy_logfile_tmp} -u ${dnscrypt_proxy_uid_tmp} -R ${dnscrypt_proxy_resolver_tmp}"
+
+ pidfile=${dnscrypt_proxy_pidfile_tmp}
+
+ _rc_restart_done=false # workaround for: service dnscrypt-proxy restart
+
+ run_rc_command "$1"
+done
diff --git a/dns/dnscrypt-proxy/files/pkg-message.in b/dns/dnscrypt-proxy/files/pkg-message.in
index d99cf15d8503..df6271a916ef 100644
--- a/dns/dnscrypt-proxy/files/pkg-message.in
+++ b/dns/dnscrypt-proxy/files/pkg-message.in
@@ -1,18 +1,13 @@
This port/software comes all 'working out of the box'.
-By default this port is using OpenDNS' resolvers,
-but other nameservers are also possible.
-
-To view available options, run:
-%%PREFIX%%/sbin/dnscrypt-proxy --help
-or read the manual: `man dnscrypt-proxy`
-
-You might like to adjust
-%%ETCDIR%%/rc.d/dnscrypt-proxy
-accordingly with your needs and/or preferences.
+By default this port is using OpenDNS' resolvers, other services are possible.
To enable dnscrypt-proxy at boot:
echo dnscrypt_proxy_enable=\"YES\" >> /etc/rc.conf
+echo dnscrypt_proxy_flags=\"-a 127.0.0.2\" >> /etc/rc.conf
+To view available options, run:
+%%PREFIX%%/sbin/dnscrypt-proxy --help
+or read the manual: `man dnscrypt-proxy`
diff --git a/dns/dnscrypt-proxy/files/pkg-message_multi.in b/dns/dnscrypt-proxy/files/pkg-message_multi.in
new file mode 100644
index 000000000000..10664ca6047e
--- /dev/null
+++ b/dns/dnscrypt-proxy/files/pkg-message_multi.in
@@ -0,0 +1,19 @@
+
+This port/software comes all 'working out of the box'.
+
+By default this port is using OpenDNS' resolvers, other services are possible.
+
+To enable dnscrypt-proxy at boot:
+echo dnscrypt_proxy_enable=\"YES\" >> /etc/rc.conf
+echo dnscrypt_proxy_instances=\"dnscrypt_proxy_1 dnscrypt_proxy_2 dnscrypt_proxy_3\" >> /etc/rc.conf
+echo dnscrypt_proxy_1_resolver=\"soltysiak\" >> /etc/rc.conf
+echo dnscrypt_proxy_1_flags=\"-a 127.0.0.2\" >> /etc/rc.conf
+echo dnscrypt_proxy_2_resolver=\"okturtles\" >> /etc/rc.conf
+echo dnscrypt_proxy_2_flags=\"-a 127.0.0.3\" >> /etc/rc.conf
+echo dnscrypt_proxy_3_resolver=\"cypherpunk\" >> /etc/rc.conf
+echo dnscrypt_proxy_3_flags=\"-a 127.0.0.4\" >> /etc/rc.conf
+
+To view available options, run:
+%%PREFIX%%/sbin/dnscrypt-proxy --help
+or read the manual: `man dnscrypt-proxy`
+