pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/net/tinydyndns-run



Module Name:    pkgsrc
Committed By:   schmonz
Date:           Sun Oct 18 12:41:34 UTC 2020

Added Files:
        pkgsrc/net/tinydyndns-run: DESCR Makefile PLIST
        pkgsrc/net/tinydyndns-run/files: README.pkgsrc tinydyn.sh
            tinydyndns-call-update.sh tinydyndns-make-client.sh
            tinydyndns-passwd.sh tinydyndns-pop3d.sh tinydyndns-pwhash.py
            tinydyndns.sh tinydynpop3d.sh

Log Message:
Initial import of tinydyndns-run, a package that creates the config
files, supporting scripts, and NetBSD-style rc.d scripts needed to
run tinydyndns.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/net/tinydyndns-run/DESCR \
    pkgsrc/net/tinydyndns-run/Makefile pkgsrc/net/tinydyndns-run/PLIST
cvs rdiff -u -r0 -r1.1 pkgsrc/net/tinydyndns-run/files/README.pkgsrc \
    pkgsrc/net/tinydyndns-run/files/tinydyn.sh \
    pkgsrc/net/tinydyndns-run/files/tinydyndns-call-update.sh \
    pkgsrc/net/tinydyndns-run/files/tinydyndns-make-client.sh \
    pkgsrc/net/tinydyndns-run/files/tinydyndns-passwd.sh \
    pkgsrc/net/tinydyndns-run/files/tinydyndns-pop3d.sh \
    pkgsrc/net/tinydyndns-run/files/tinydyndns-pwhash.py \
    pkgsrc/net/tinydyndns-run/files/tinydyndns.sh \
    pkgsrc/net/tinydyndns-run/files/tinydynpop3d.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/net/tinydyndns-run/DESCR
diff -u /dev/null pkgsrc/net/tinydyndns-run/DESCR:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/DESCR     Sun Oct 18 12:41:33 2020
@@ -0,0 +1,2 @@
+This package creates the config files, supporting scripts, and
+NetBSD-style rc.d scripts needed to run tinydyndns.
Index: pkgsrc/net/tinydyndns-run/Makefile
diff -u /dev/null pkgsrc/net/tinydyndns-run/Makefile:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/Makefile  Sun Oct 18 12:41:33 2020
@@ -0,0 +1,75 @@
+# $NetBSD: Makefile,v 1.1 2020/10/18 12:41:33 schmonz Exp $
+#
+
+DISTNAME=              tinydyndns-run-20201018
+CATEGORIES=            net
+MASTER_SITES=          # empty
+DISTFILES=             # empty
+
+MAINTAINER=            schmonz%NetBSD.org@localhost
+COMMENT=               Configures tinydyndns to serve and update records
+LICENSE=               2-clause-bsd
+
+DEPENDS+=              qmail-[0-9]*:../../mail/qmail
+DEPENDS+=              tinydyndns-[0-9]*:../../net/tinydyndns
+DEPENDS+=              cvm-[0-9]*:../../security/cvm
+DEPENDS+=              daemontools-[0-9]*:../../sysutils/daemontools
+
+WRKSRC=                        ${WRKDIR}
+NO_BUILD=              yes
+NO_CHECKSUM=           yes
+
+PKG_SYSCONFSUBDIR=     tinydyn
+PKG_SYSCONFDIR_PERMS=  ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} 3755
+
+CONF_FILES_MODE=       0600
+CONF_FILES+=           ${PREFIX}/share/examples/${PKGBASE}/passwd \
+                       ${PKG_SYSCONFDIR}/passwd
+
+PKG_USERS+=            ${TINYDYN_USER}:${DJBDNS_DJBDNS_GROUP}
+RCD_SCRIPTS=           tinydyn tinydyndns tinydynpop3d
+FILES_SUBST+=          TINYDYN_USER=${TINYDYN_USER:Q}
+FILES_SUBST+=          DJBDNS_LOG_USER=${DJBDNS_LOG_USER:Q}
+FILES_SUBST+=          PKGNAME=${PKGNAME:Q}
+FILES_SUBST+=          CUT=${CUT:Q}
+
+BUILD_DEFS+=           TINYDYN_USER DJBDNS_LOG_USER
+BUILD_DEFS+=           DJBDNS_DJBDNS_GROUP
+
+SUBST_CLASSES+=                rcd
+SUBST_STAGE.rcd=       pre-configure
+SUBST_FILES.rcd=       README.pkgsrc
+SUBST_VARS.rcd=                PKG_SYSCONFDIR RCD_SCRIPTS_DIR
+
+SUBST_CLASSES+=                scripts
+SUBST_STAGE.scripts=   pre-configure
+SUBST_FILES.scripts=   tinydyndns-call-update tinydyndns-make-client
+SUBST_FILES.scripts+=  tinydyndns-passwd tinydyndns-pop3d
+SUBST_VARS.scripts=    SH PKGNAME ECHO PKG_SYSCONFDIR PREFIX HEAD
+SUBST_VARS.scripts+=   ID GREP CAT SED MV CHMOD NOLOGIN
+SUBST_VARS.scripts+=   TINYDYN_USER
+
+PYTHON_VERSIONS_INCOMPATIBLE=  27
+REPLACE_PYTHON=                tinydyndns-pwhash
+
+INSTALLATION_DIRS=     bin share/doc/${PKGBASE} share/examples/${PKGBASE}
+
+post-extract:
+       ${CP} ${FILESDIR}/README.pkgsrc ${WRKSRC}/
+       for f in tinydyndns-call-update tinydyndns-make-client \
+               tinydyndns-passwd tinydyndns-pop3d; do \
+               ${CP} ${FILESDIR}/$$f.sh ${WRKSRC}/$$f; \
+       done
+       ${CP} ${FILESDIR}/tinydyndns-pwhash.py ${WRKSRC}/tinydyndns-pwhash
+
+do-install:
+       ${INSTALL_DATA} ${WRKSRC}/README.pkgsrc ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
+       for f in tinydyndns-call-update tinydyndns-make-client \
+               tinydyndns-passwd tinydyndns-pop3d tinydyndns-pwhash; do \
+               ${INSTALL_SCRIPT} ${WRKSRC}/$$f ${DESTDIR}${PREFIX}/bin; \
+       done
+       ${TOUCH} ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/passwd; \
+       ${CHMOD} 600 ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/passwd
+
+.include "../../lang/python/application.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/net/tinydyndns-run/PLIST
diff -u /dev/null pkgsrc/net/tinydyndns-run/PLIST:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/PLIST     Sun Oct 18 12:41:33 2020
@@ -0,0 +1,8 @@
+@comment $NetBSD: PLIST,v 1.1 2020/10/18 12:41:33 schmonz Exp $
+bin/tinydyndns-call-update
+bin/tinydyndns-make-client
+bin/tinydyndns-passwd
+bin/tinydyndns-pop3d
+bin/tinydyndns-pwhash
+share/doc/tinydyndns-run/README.pkgsrc
+share/examples/tinydyndns-run/passwd

Index: pkgsrc/net/tinydyndns-run/files/README.pkgsrc
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/README.pkgsrc:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/README.pkgsrc       Sun Oct 18 12:41:33 2020
@@ -0,0 +1,34 @@
+ Getting started
+ ===============
+
+Assuming NetBSD-style rc(8), to enable...
+
+Dynamic-capable authoritative DNS service:
+- Choose the domain for dynamic hostnames and the server IP.
+- Run "echo your.dyn.domain > @PKG_SYSCONFDIR@/domain".
+- Set tinydyndns=YES (and tinydyndns_ip) in /etc/rc.conf.
+- Run "@RCD_SCRIPTS_DIR@/tinydyndns start".
+- Arrange for the domain to be delegated to your new DNS server.
+
+Dynamic DNS updates via POP3:
+- Set tinydynpop3d=YES in /etc/rc.conf.
+- Run "@RCD_SCRIPTS_DIR@/tinydynpop3d start".
+
+A new dynamic-DNS hostname:
+- Run "tinydyndns-passwd <hostname> <password>".
+- Configure a POP3 client with the same username (hostname) and password.
+
+Without a POP3 client:
+- Copy the output of "tinydyndns-make-client <hostname>" to the desired system.
+- Store the password in the client script (or perhaps a password vault).
+- Run the client script from cron, when your IP changes, or as you prefer.
+
+
+ Getting help
+ ============
+
+You've installed an automated and customized tinydyndns-run package.
+If you're having trouble getting the tinydyndns daemons to run, ask
+the package's maintainer:
+
+<URL:mailto:schmonz-pkgsrc-tinydyndns%schmonz.com@localhost>
Index: pkgsrc/net/tinydyndns-run/files/tinydyn.sh
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/tinydyn.sh:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/tinydyn.sh  Sun Oct 18 12:41:33 2020
@@ -0,0 +1,61 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: tinydyn.sh,v 1.1 2020/10/18 12:41:33 schmonz Exp $
+#
+# @PKGNAME@ master script for administrators to control tinydyndns
+# services.
+#
+
+# KEYWORD: nostart
+
+if [ -f /etc/rc.subr ]; then
+       . /etc/rc.subr
+fi
+
+rcd_dir=`@DIRNAME@ $0`
+
+# NOTE: run_rc_command sets $rc_arg
+#
+forward_commands() {
+       tinydyndnsrcd $COMMAND_LIST
+}
+
+reverse_commands() {
+       REVCOMMAND_LIST=
+       for file in $COMMAND_LIST; do
+               REVCOMMAND_LIST="$file $REVCOMMAND_LIST"
+       done
+
+       tinydyndnsrcd $REVCOMMAND_LIST
+}
+
+tinydyndnsrcd() {
+       # Backward compat with NetBSD <1.6:
+       [ -z "$rc_arg" ] && rc_arg=$_arg
+
+       for service in "$@"; do
+               if [ -f /etc/rc.subr ]; then
+                       load_rc_config $service
+                       if checkyesno $service; then
+                               $rcd_dir/${service} $rc_arg
+                       fi
+               else
+                       $rcd_dir/${service} $rc_arg
+               fi
+       done
+}
+
+COMMAND_LIST="tinydyndns tinydynpop3d"
+
+name="tinydyndns"
+start_cmd="forward_commands"
+stop_cmd="reverse_commands"
+status_cmd="forward_commands"
+extra_commands="status"
+
+if [ -f /etc/rc.subr ]; then
+       run_rc_command "$1"
+else
+       _arg="$1"
+       ${start_cmd}
+fi
Index: pkgsrc/net/tinydyndns-run/files/tinydyndns-call-update.sh
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/tinydyndns-call-update.sh:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/tinydyndns-call-update.sh   Sun Oct 18 12:41:33 2020
@@ -0,0 +1,17 @@
+#!@SH@
+#
+# $NetBSD: tinydyndns-call-update.sh,v 1.1 2020/10/18 12:41:33 schmonz Exp $
+#
+# @PKGNAME@ program to update DNS record for POP3 authenticated user
+
+if [ $# -eq 0 ]; then
+       @ECHO@ "usage: $0 program" >&2
+       exit 1
+fi
+
+@ECHO@ "login: ${USER}: ${TCPREMOTEIP}" >&7
+cd @PKG_SYSCONFDIR@
+@PREFIX@/bin/setlock data.cdb \
+       @PREFIX@/bin/tinydyndns-update ${USER}.$(@HEAD@ -1 domain) ${TCPREMOTEIP} >&7 \
+       2>&1
+exec "$@"
Index: pkgsrc/net/tinydyndns-run/files/tinydyndns-make-client.sh
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/tinydyndns-make-client.sh:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/tinydyndns-make-client.sh   Sun Oct 18 12:41:33 2020
@@ -0,0 +1,33 @@
+#!@SH@
+
+if [ -z "$1" ]; then
+       echo "Usage: $0 hostname" >&2
+       exit 1
+fi
+
+dyn_hostname="$1"
+DOMAIN=$(@HEAD@ -1 @PKG_SYSCONFDIR@/domain)
+
+cat <<EOF
+#!@SH@
+
+dyn_hostname=${dyn_hostname}
+dyn_password=your-password-here
+
+TCPCLIENT=@PREFIX@/bin/tcpclient
+DOMAIN=${DOMAIN}
+PORT=110
+
+main() {
+       \${TCPCLIENT} \${DOMAIN} \${PORT} @SH@ -c "exec 0<&6; exec 1>&7
+               echo USER \${dyn_hostname}
+               read input
+               echo PASS \${dyn_password}
+               read input
+               echo QUIT
+               read input"
+}
+
+main "\$@"
+exit \$?
+EOF
Index: pkgsrc/net/tinydyndns-run/files/tinydyndns-passwd.sh
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/tinydyndns-passwd.sh:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/tinydyndns-passwd.sh        Sun Oct 18 12:41:33 2020
@@ -0,0 +1,71 @@
+#!@SH@
+
+TINYDYN_ETC="@PKG_SYSCONFDIR@"
+TINYDYN_DOMAIN=$(@HEAD@ -1 ${TINYDYN_ETC}/domain)
+TINYDYN_PASSWD="${TINYDYN_ETC}/passwd"
+TINYDYN_PASSWDTMP="${TINYDYN_ETC}/passwd{new}"
+TINYDYN_USER=@TINYDYN_USER@
+TINYDYN_UID=$(@ID@ -u ${TINYDYN_USER})
+TINYDYN_GID=$(@ID@ -g ${TINYDYN_USER})
+TINYDYN_SHELL="@NOLOGIN@"
+
+passwd_exists_for() {
+       local _hostname
+       _hostname=$1
+       @GREP@ "^${_hostname}:" ${TINYDYN_PASSWD} >/dev/null 2>/dev/null
+}
+
+passwd_hash() {
+       local _password
+       _password=$1
+       echo "$1" | @PREFIX@/bin/tinydyndns-pwhash
+}
+
+passwd_add() {
+       local _hostname _password
+       _hostname=$1
+       _password=$2
+       _hashed_password=$(passwd_hash "${_password}")
+       @CAT@ ${TINYDYN_PASSWD} >${TINYDYN_PASSWDTMP} 2>/dev/null
+       echo "${_hostname}:${_hashed_password}:${TINYDYN_UID}:${TINYDYN_GID}::${TINYDYN_ETC}:${TINYDYN_SHELL}" \
+               >>${TINYDYN_PASSWDTMP}
+}
+
+passwd_update() {
+       local _hostname _password
+       _hostname=$1
+       _password=$2
+       _hashed_password=$(passwd_hash "${_password}")
+       @SED@ -e \
+               "s|^${_hostname}:.*$|${_hostname}:${_hashed_password}:${TINYDYN_UID}:${TINYDYN_GID}::${TINYDYN_ETC}:${TINYDYN_SHELL}|g" \
+               ${TINYDYN_PASSWD} >${TINYDYN_PASSWDTMP}
+}
+
+dyndns_add() {
+       local _hostname
+       _hostname=$1
+       ( cd ${TINYDYN_ETC}; @PREFIX@/bin/tinydyndns-data add ${_hostname}.${TINYDYN_DOMAIN} )
+}
+
+main() {
+       if [ -z "$1" -o -z "$2" ]; then
+               echo "Usage: $0 hostname password" >&2
+               return 1
+       fi
+
+       dyn_hostname=$1
+       dyn_password=$2
+
+       if passwd_exists_for "${dyn_hostname}"; then
+               passwd_update "${dyn_hostname}" "${dyn_password}"
+       else
+               passwd_add "${dyn_hostname}" "${dyn_password}"
+       fi
+       @MV@ -f ${TINYDYN_PASSWDTMP} ${TINYDYN_PASSWD}
+       @CHMOD@ 600 ${TINYDYN_PASSWD}
+
+       dyndns_add "${dyn_hostname}"
+}
+
+main "$@"
+exit $?
Index: pkgsrc/net/tinydyndns-run/files/tinydyndns-pop3d.sh
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/tinydyndns-pop3d.sh:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/tinydyndns-pop3d.sh Sun Oct 18 12:41:33 2020
@@ -0,0 +1,18 @@
+#!@SH@
+
+main() {
+       echo '+OK '
+       read input
+       if [ "$input" = 'LIST' ]; then
+               echo '+OK'
+               echo '.'
+       elif [ "$input" = 'STAT' ]; then
+               echo '+OK 0 0'
+       fi
+       read input
+       echo '+OK'
+       return 0
+}
+
+main "$@"
+exit $?
Index: pkgsrc/net/tinydyndns-run/files/tinydyndns-pwhash.py
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/tinydyndns-pwhash.py:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/tinydyndns-pwhash.py        Sun Oct 18 12:41:33 2020
@@ -0,0 +1,5 @@
+#!/usr/bin/env python
+
+import crypt, sys
+
+print(crypt.crypt(sys.stdin.read().rstrip()))
Index: pkgsrc/net/tinydyndns-run/files/tinydyndns.sh
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/tinydyndns.sh:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/tinydyndns.sh       Sun Oct 18 12:41:33 2020
@@ -0,0 +1,109 @@
+#!@RCD_SCRIPTS_SHELL@
+
+# PROVIDE: tinydyndns named
+# REQUIRE: NETWORKING mountcritremote syslogd
+# BEFORE:  DAEMON
+
+name="tinydyndns"
+
+# User-settable rc.conf variables and their default values:
+: ${tinydyndns_postenv:=""}
+: ${tinydyndns_ip:="0.0.0.0"}
+: ${tinydyndns_datalimit:="300000"}
+: ${tinydyndns_autodata:="YES"}
+: ${tinydyndns_autocdb:="YES"}
+: ${tinydyndns_log:="YES"}
+: ${tinydyndns_logcmd:="logger -t nbtinydyn/dns -p daemon.info"}
+: ${tinydyndns_nologcmd:="@PREFIX@/bin/multilog -*"}
+
+tinydyn_data="@PKG_SYSCONFDIR@/data"
+tinydyn_domain="@PKG_SYSCONFDIR@/domain"
+tinydyn_passwd="@PKG_SYSCONFDIR@/passwd"
+
+if [ -f /etc/rc.subr ]; then
+       . /etc/rc.subr
+fi
+
+rcvar=${name}
+required_files="${tinydyn_domain} ${tinydyn_passwd}"
+command="@PREFIX@/bin/tinydns"
+procname=nb${name}
+start_precmd="tinydyndns_precmd"
+extra_commands="rebuild"
+rebuild_cmd="tinydyndns_rebuild"
+
+tinydyndns_precmd() {
+       if [ -f /etc/rc.subr ] && ! checkyesno tinydyndns_log; then
+               tinydyndns_logcmd=${tinydyndns_nologcmd}
+       fi
+       if [ -f /etc/rc.subr ] && checkyesno tinydyndns_autodata; then
+               tinydyndns_needdata && tinydyndns_initdata
+       else
+               required_files="${tinydyn_data} ${required_files}"
+       fi
+       if [ -f /etc/rc.subr ] && checkyesno tinydyndns_autocdb; then
+               tinydyndns_needcdb && tinydyndns_rebuild
+       else
+               required_files="${tinydyn_data}.cdb ${required_files}"
+       fi
+       command="@PREFIX@/bin/pgrphack @SETENV@ - ${tinydyndns_postenv} \
+ROOT=@PKG_SYSCONFDIR@ \
+IP=${tinydyndns_ip} \
+@PREFIX@/bin/envuidgid @TINYDYN_USER@ \
+@PREFIX@/bin/softlimit -d ${tinydyndns_datalimit} \
+@PREFIX@/bin/argv0 @PREFIX@/bin/tinydns ${procname} \
+</dev/null 2>&1 | \
+@PREFIX@/bin/pgrphack @PREFIX@/bin/setuidgid @DJBDNS_LOG_USER@ ${tinydyndns_logcmd}"
+       command_args="&"
+       rc_flags=""
+}
+
+tinydyndns_needdata() {
+       [ ! -f "${tinydyn_data}" ]
+}
+
+tinydyndns_initdata() {
+       @ECHO@ "Auto-creating ${tinydyn_data}."
+       if [ ${tinydyndns_ip} = "0.0.0.0" ]; then
+               @ECHO@ >&2 "ERROR: set tinydyndns_ip in rc.conf"
+               exit 1
+       fi
+       _domain=$(@HEAD@ -1 ${tinydyn_domain})
+       if [ -z "${_domain}" ]; then
+               @ECHO@ >&2 "ERROR: write the domain to ${tinydyn_domain}"
+               exit 2
+       fi
+       @CAT@ >${tinydyn_data}.tmp <<EOF
+.${_domain}:${tinydyndns_ip}:a:259200
++${_domain}:${tinydyndns_ip}:86400
+EOF
+       @MV@ -f ${tinydyn_data}.tmp ${tinydyn_data}
+       @CHOWN@ @TINYDYN_USER@ ${tinydyn_data}
+       @CHMOD@ 644 ${tinydyn_data}
+}
+
+tinydyndns_needcdb() {
+       _src=${tinydyn_data}
+       _dst=${tinydyn_data}.cdb
+       [ -f "${_src}" -a "${_src}" -nt "${_dst}" ] || [ ! -f "${_dst}" ]
+}
+
+tinydyndns_rebuild() {
+       @ECHO@ "Rebuilding ${tinydyn_data}.cdb."
+       cd @PKG_SYSCONFDIR@ && @PREFIX@/bin/tinydns-data
+       _domain=$(@HEAD@ -1 ${tinydyn_domain})
+       @CUT@ -d: -f1 < ${tinydyn_passwd} \
+               | @SED@ -e "s|\$|.${_domain}|" \
+               | @XARGS@ @PREFIX@/bin/tinydyndns-data add
+       @CHOWN@ @TINYDYN_USER@ ${tinydyn_data}.cdb
+       @CHMOD@ 644 ${tinydyn_data}.cdb
+}
+
+if [ -f /etc/rc.subr ]; then
+       load_rc_config $name
+       run_rc_command "$1"
+else
+       @ECHO_N@ " ${name}"
+       tinydyndns_precmd
+       eval ${command} ${tinydyndns_flags} ${command_args}
+fi
Index: pkgsrc/net/tinydyndns-run/files/tinydynpop3d.sh
diff -u /dev/null pkgsrc/net/tinydyndns-run/files/tinydynpop3d.sh:1.1
--- /dev/null   Sun Oct 18 12:41:34 2020
+++ pkgsrc/net/tinydyndns-run/files/tinydynpop3d.sh     Sun Oct 18 12:41:33 2020
@@ -0,0 +1,67 @@
+#!@RCD_SCRIPTS_SHELL@
+
+# PROVIDE: tinydynpop3d named
+
+name="tinydynpop3d"
+
+# User-settable rc.conf variables and their default values:
+: ${tinydynpop3d_postenv:="CVM_PWFILE_PWCMP=crypt"}
+: ${tinydynpop3d_datalimit:="4000000"}
+: ${tinydynpop3d_pretcpserver:=""}
+: ${tinydynpop3d_tcpserver:="@PREFIX@/bin/tcpserver"}
+: ${tinydynpop3d_tcpflags:="-vRH"}
+: ${tinydynpop3d_tcphost:="0.0.0.0"}
+: ${tinydynpop3d_tcpport:="110"}
+: ${tinydynpop3d_precheckpassword:="@PREFIX@/bin/qmail-popup $(@HEAD@ -1 @PKG_SYSCONFDIR@/domain)"}
+: ${tinydynpop3d_checkpassword:="@PREFIX@/bin/cvm-checkpassword @PREFIX@/bin/cvm-pwfile"}
+: ${tinydynpop3d_prepop3d:="@PREFIX@/bin/tinydyndns-call-update"}
+: ${tinydynpop3d_pop3dcmd:="@PREFIX@/bin/tinydyndns-pop3d"}
+: ${tinydynpop3d_postpop3d:=""}
+: ${tinydynpop3d_log:="YES"}
+: ${tinydynpop3d_logcmd:="logger -t nbtinydyn/pop3d -p mail.info"}
+: ${tinydynpop3d_nologcmd:="@PREFIX@/bin/multilog -*"}
+
+tinydyn_cdb="@PKG_SYSCONFDIR@/data.cdb"
+tinydyn_domain="@PKG_SYSCONFDIR@/domain"
+tinydyn_passwd="@PKG_SYSCONFDIR@/passwd"
+
+if [ -f /etc/rc.subr ]; then
+       . /etc/rc.subr
+fi
+
+rcvar=${name}
+required_files="${tinydyn_cdb} ${tinydyn_domain}"
+rcvar=${name}
+command="${tinydynpop3d_tcpserver}"
+procname=nb${name}
+start_precmd="tinydynpop3d_precmd"
+
+tinydynpop3d_precmd() {
+       if [ -f /etc/rc.subr ] && ! checkyesno tinydynpop3d_log; then
+               tinydynpop3d_logcmd=${tinydynpop3d_nologcmd}
+       fi
+       # tcpserver(1) is akin to inetd(8), but runs one service per process.
+       # We want to signal only the tcpserver process responsible for this
+       # service. Use argv0(1) to set procname to "nbtinydynpop3d".
+       command="@PREFIX@/bin/pgrphack @SETENV@ - ${tinydynpop3d_postenv} \
+CVM_PWFILE_PATH=${tinydyn_passwd} \
+@PREFIX@/bin/softlimit -m ${tinydynpop3d_datalimit} ${tinydynpop3d_pretcpserver} \
+@PREFIX@/bin/argv0 ${tinydynpop3d_tcpserver} ${procname} \
+${tinydynpop3d_tcpflags} \
+${tinydynpop3d_tcphost} ${tinydynpop3d_tcpport} \
+${tinydynpop3d_precheckpassword} ${tinydynpop3d_checkpassword} \
+${tinydynpop3d_prepop3d} ${tinydynpop3d_pop3dcmd} ${tinydynpop3d_postpop3d} \
+2>&1 7>&1 | \
+@PREFIX@/bin/pgrphack @PREFIX@/bin/setuidgid @DJBDNS_LOG_USER@ ${tinydynpop3d_logcmd}"
+       command_args="&"
+       rc_flags=""
+}
+
+if [ -f /etc/rc.subr ]; then
+       load_rc_config $name
+       run_rc_command "$1"
+else
+       @ECHO_N@ " ${name}"
+       tinydynpop3d_precmd
+       eval ${command} ${tinydynpop3d_flags} ${command_args}
+fi



Home | Main Index | Thread Index | Old Index