pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/net/tinydyndns-run Initial import of tinydyndns-run, a...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c8b5e5df75d8
branches:  trunk
changeset: 440769:c8b5e5df75d8
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Sun Oct 18 12:41:33 2020 +0000

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

diffstat:

 net/tinydyndns-run/DESCR                           |    2 +
 net/tinydyndns-run/Makefile                        |   75 ++++++++++++++
 net/tinydyndns-run/PLIST                           |    8 +
 net/tinydyndns-run/files/README.pkgsrc             |   34 ++++++
 net/tinydyndns-run/files/tinydyn.sh                |   61 +++++++++++
 net/tinydyndns-run/files/tinydyndns-call-update.sh |   17 +++
 net/tinydyndns-run/files/tinydyndns-make-client.sh |   33 ++++++
 net/tinydyndns-run/files/tinydyndns-passwd.sh      |   71 +++++++++++++
 net/tinydyndns-run/files/tinydyndns-pop3d.sh       |   18 +++
 net/tinydyndns-run/files/tinydyndns-pwhash.py      |    5 +
 net/tinydyndns-run/files/tinydyndns.sh             |  109 +++++++++++++++++++++
 net/tinydyndns-run/files/tinydynpop3d.sh           |   67 ++++++++++++
 12 files changed, 500 insertions(+), 0 deletions(-)

diffs (truncated from 548 to 300 lines):

diff -r 5ac749edfd9d -r c8b5e5df75d8 net/tinydyndns-run/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/tinydyndns-run/DESCR  Sun Oct 18 12:41:33 2020 +0000
@@ -0,0 +1,2 @@
+This package creates the config files, supporting scripts, and
+NetBSD-style rc.d scripts needed to run tinydyndns.
diff -r 5ac749edfd9d -r c8b5e5df75d8 net/tinydyndns-run/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/tinydyndns-run/Makefile       Sun Oct 18 12:41:33 2020 +0000
@@ -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"
diff -r 5ac749edfd9d -r c8b5e5df75d8 net/tinydyndns-run/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/tinydyndns-run/PLIST  Sun Oct 18 12:41:33 2020 +0000
@@ -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
diff -r 5ac749edfd9d -r c8b5e5df75d8 net/tinydyndns-run/files/README.pkgsrc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/tinydyndns-run/files/README.pkgsrc    Sun Oct 18 12:41:33 2020 +0000
@@ -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>
diff -r 5ac749edfd9d -r c8b5e5df75d8 net/tinydyndns-run/files/tinydyn.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/tinydyndns-run/files/tinydyn.sh       Sun Oct 18 12:41:33 2020 +0000
@@ -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
diff -r 5ac749edfd9d -r c8b5e5df75d8 net/tinydyndns-run/files/tinydyndns-call-update.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/tinydyndns-run/files/tinydyndns-call-update.sh        Sun Oct 18 12:41:33 2020 +0000
@@ -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 "$@"
diff -r 5ac749edfd9d -r c8b5e5df75d8 net/tinydyndns-run/files/tinydyndns-make-client.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/tinydyndns-run/files/tinydyndns-make-client.sh        Sun Oct 18 12:41:33 2020 +0000
@@ -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
diff -r 5ac749edfd9d -r c8b5e5df75d8 net/tinydyndns-run/files/tinydyndns-passwd.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/tinydyndns-run/files/tinydyndns-passwd.sh     Sun Oct 18 12:41:33 2020 +0000
@@ -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}")



Home | Main Index | Thread Index | Old Index