diff options
author | schmonz <schmonz@pkgsrc.org> | 2015-01-27 23:01:31 +0000 |
---|---|---|
committer | schmonz <schmonz@pkgsrc.org> | 2015-01-27 23:01:31 +0000 |
commit | 4845eb5bebbd75d756223c12dc3141e4fa9b2aa9 (patch) | |
tree | 63737d81c12909cad0ea3549d13d331f502eb108 /net/publicfile-run | |
parent | ed0064ff16320df1c9b7608a2b8e3d54297ed274 (diff) | |
download | pkgsrc-4845eb5bebbd75d756223c12dc3141e4fa9b2aa9.tar.gz |
Add publicfile-run, a package that creates the users and group
needed to run publicfile services and provides NetBSD-style rc.d
scripts, in the pkgsrc tradition of qmail-run and djbdns-run. By
J. Lewis Muir, from wip.
Diffstat (limited to 'net/publicfile-run')
-rw-r--r-- | net/publicfile-run/DESCR | 2 | ||||
-rw-r--r-- | net/publicfile-run/MESSAGE | 22 | ||||
-rw-r--r-- | net/publicfile-run/Makefile | 59 | ||||
-rw-r--r-- | net/publicfile-run/PLIST | 3 | ||||
-rw-r--r-- | net/publicfile-run/files/README.pkgsrc | 11 | ||||
-rw-r--r-- | net/publicfile-run/files/libexec-pubftpd.sh | 16 | ||||
-rw-r--r-- | net/publicfile-run/files/pubfile.sh | 60 | ||||
-rw-r--r-- | net/publicfile-run/files/pubftpd.sh | 54 | ||||
-rw-r--r-- | net/publicfile-run/files/pubhttpd.sh | 57 |
9 files changed, 284 insertions, 0 deletions
diff --git a/net/publicfile-run/DESCR b/net/publicfile-run/DESCR new file mode 100644 index 00000000000..d25207cab36 --- /dev/null +++ b/net/publicfile-run/DESCR @@ -0,0 +1,2 @@ +This package creates the users and group needed to run publicfile +services and provides NetBSD-style rc.d scripts. diff --git a/net/publicfile-run/MESSAGE b/net/publicfile-run/MESSAGE new file mode 100644 index 00000000000..d8e181b92b7 --- /dev/null +++ b/net/publicfile-run/MESSAGE @@ -0,0 +1,22 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1 2015/01/27 23:01:31 schmonz Exp $ + +Please read ${PREFIX}/share/doc/publicfile-run/README.pkgsrc. + +To enable the... + +FTP service: +- Set pubftpd=YES in /etc/rc.conf. +- Create ${VARBASE}/public with suitable contents. + This is the _root_ directory described at + <http://cr.yp.to/publicfile/ftpd.html> and the _D_/file directory + described at <http://cr.yp.to/publicfile/configure.html>. + +HTTP service: +- Set pubhttpd=YES in /etc/rc.conf. +- Create ${VARBASE}/public with suitable contents. + This is the _root_ directory described at + <http://cr.yp.to/publicfile/httpd.html> and the _D_/file directory + described at <http://cr.yp.to/publicfile/configure.html>. + +=========================================================================== diff --git a/net/publicfile-run/Makefile b/net/publicfile-run/Makefile new file mode 100644 index 00000000000..bdb3d5b3d35 --- /dev/null +++ b/net/publicfile-run/Makefile @@ -0,0 +1,59 @@ +# $NetBSD: Makefile,v 1.1 2015/01/27 23:01:31 schmonz Exp $ + +DISTNAME= publicfile-run-20150109 +CATEGORIES= net +MASTER_SITES= # empty +DISTFILES= # empty + +MAINTAINER= jlmuir@imca-cat.org +COMMENT= Configures publicfile to serve public files +LICENSE= 2-clause-bsd + +DEPENDS+= publicfile>=0.52:../../net/publicfile +DEPENDS+= daemontools-[0-9]*:../../sysutils/daemontools +DEPENDS+= ucspi-tcp-[0-9]*:../../net/ucspi-tcp + +WRKSRC= ${WRKDIR} +NO_BUILD= yes +NO_CHECKSUM= yes +REPLACE_SH= libexec-pubftpd + +PKG_GROUPS= pubfile +PKG_USERS+= pubftp:pubfile +PKG_USERS+= pubhttp:pubfile +PKG_USERS+= publog:pubfile +RCD_SCRIPTS= pubfile pubftpd pubhttpd + +MESSAGE_SUBST+= VARBASE=${VARBASE:Q} + +EVAL_PREFIX+= DAEMONTOOLS_PREFIX=daemontools +EVAL_PREFIX+= PUBLICFILE_PREFIX=publicfile +EVAL_PREFIX+= UCSPI_TCP_PREFIX=ucspi-tcp + +FILES_SUBST+= PKGNAME=${PKGNAME:Q} +FILES_SUBST+= DAEMONTOOLS_PREFIX=${DAEMONTOOLS_PREFIX:Q} +FILES_SUBST+= PUBLICFILE_PREFIX=${PUBLICFILE_PREFIX:Q} +FILES_SUBST+= UCSPI_TCP_PREFIX=${UCSPI_TCP_PREFIX:Q} + +SUBST_CLASSES+= paths +SUBST_MESSAGE.paths= Substituting paths. +SUBST_STAGE.paths= post-patch +SUBST_FILES.paths= libexec-pubftpd +SUBST_VARS.paths= UCSPI_TCP_PREFIX + +BUILD_DEFS+= VARBASE + +INSTALLATION_DIRS= libexec share/doc/publicfile-run + +.include "../../mk/bsd.prefs.mk" + +post-extract: + ${CP} ${FILESDIR}/libexec-pubftpd.sh ${WRKSRC}/libexec-pubftpd + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/libexec-pubftpd \ + ${DESTDIR}${PREFIX}/libexec/pubftpd + ${INSTALL_DATA} ${FILESDIR}/README.pkgsrc \ + ${DESTDIR}${PREFIX}/share/doc/publicfile-run + +.include "../../mk/bsd.pkg.mk" diff --git a/net/publicfile-run/PLIST b/net/publicfile-run/PLIST new file mode 100644 index 00000000000..f78ac2bb285 --- /dev/null +++ b/net/publicfile-run/PLIST @@ -0,0 +1,3 @@ +@comment $NetBSD: PLIST,v 1.1 2015/01/27 23:01:31 schmonz Exp $ +libexec/pubftpd +share/doc/publicfile-run/README.pkgsrc diff --git a/net/publicfile-run/files/README.pkgsrc b/net/publicfile-run/files/README.pkgsrc new file mode 100644 index 00000000000..a89834bf0ad --- /dev/null +++ b/net/publicfile-run/files/README.pkgsrc @@ -0,0 +1,11 @@ + Getting help + ============ + +You've installed an automated and customized publicfile-run package. +If you're having trouble getting the publicfile daemons to run, ask +the package's maintainer: + +<URL:mailto:jlmuir@imca-cat.org> + +If you need to ask for help on the publicfile list, please mention that +you're using the publicfile-run package from pkgsrc. diff --git a/net/publicfile-run/files/libexec-pubftpd.sh b/net/publicfile-run/files/libexec-pubftpd.sh new file mode 100644 index 00000000000..8680ad4e1d8 --- /dev/null +++ b/net/publicfile-run/files/libexec-pubftpd.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# +# Executes tcpserver with "pubftpd" as the 0th argument and with a fixed banner +# appropriate for DJB's publicfile FTP server. +# +# The reason for this script, as opposed to invoking tcpserver directly, is +# that the banner (specified with the -B option) needs to include a trailing +# carriage-return and newline (\015\012) which is difficult, if not impossible, +# to specify in a NetBSD rc(8) script because rc(8) uses "eval" to evaluate the +# constructed command. +# + +exec @UCSPI_TCP_PREFIX@/bin/argv0 @UCSPI_TCP_PREFIX@/bin/tcpserver pubftpd \ +-B'220 Features: a p .
+' "$@" diff --git a/net/publicfile-run/files/pubfile.sh b/net/publicfile-run/files/pubfile.sh new file mode 100644 index 00000000000..2809116da82 --- /dev/null +++ b/net/publicfile-run/files/pubfile.sh @@ -0,0 +1,60 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: pubfile.sh,v 1.1 2015/01/27 23:01:31 schmonz Exp $ +# +# @PKGNAME@ master script for administrators to control publicfile +# services. +# +# For Red Hat chkconfig +# chkconfig: - 85 15 +# description: DJB's publicfile HTTP and FTP 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() +{ + # Backward compat with NetBSD <1.6: + [ -z "$rc_arg" ] && rc_arg=$_arg + + for file in $COMMAND_LIST; do + $rcd_dir/$file $rc_arg + done +} + +reverse_commands() +{ + # Backward compat with NetBSD <1.6: + [ -z "$rc_arg" ] && rc_arg=$_arg + + REVCOMMAND_LIST= + for file in $COMMAND_LIST; do + REVCOMMAND_LIST="$file $REVCOMMAND_LIST" + done + for file in $REVCOMMAND_LIST; do + $rcd_dir/$file $rc_arg + done +} + +COMMAND_LIST="pubftpd pubhttpd" + +name="pubfile" +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 --git a/net/publicfile-run/files/pubftpd.sh b/net/publicfile-run/files/pubftpd.sh new file mode 100644 index 00000000000..252b13917b0 --- /dev/null +++ b/net/publicfile-run/files/pubftpd.sh @@ -0,0 +1,54 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: pubftpd.sh,v 1.1 2015/01/27 23:01:31 schmonz Exp $ +# +# @PKGNAME@ script to control publicfile ftpd (FTP server) +# + +# PROVIDE: pubftpd +# REQUIRE: NETWORKING mountcritremote syslogd +# BEFORE: DAEMON + +name="pubftpd" + +# User-settable rc.conf variables and their default values: +: ${pubftpd_root:="@VARBASE@/public"} +: ${pubftpd_postenv:=""} +: ${pubftpd_datalimit:="50000"} +: ${pubftpd_localname:="0"} +: ${pubftpd_backlog:="20"} +: ${pubftpd_conlimit:="40"} +: ${pubftpd_host:="0"} +: ${pubftpd_port:="21"} +: ${pubftpd_log:="YES"} +: ${pubftpd_logcmd:="logger -t nb${name} -p ftp.info"} +: ${pubftpd_nologcmd:="@DAEMONTOOLS_PREFIX@/bin/multilog -*"} + +if [ -f /etc/rc.subr ]; then + . /etc/rc.subr +fi + +rcvar=${name} +required_dirs="${pubftpd_root}" +command="@PREFIX@/libexec/pubftpd" +procname=${name} +start_precmd="pubftpd_precmd" + +pubftpd_precmd() +{ + if [ -f /etc/rc.subr ]; then + checkyesno pubftpd_log || pubftpd_logcmd=${pubftpd_nologcmd} + fi + command="@SETENV@ - ${pubftpd_postenv} @DAEMONTOOLS_PREFIX@/bin/envuidgid pubftp @DAEMONTOOLS_PREFIX@/bin/softlimit -o20 -d${pubftpd_datalimit} @PREFIX@/libexec/pubftpd -vDRH -l${pubftpd_localname} -b${pubftpd_backlog} -c${pubftpd_conlimit} ${pubftpd_host} ${pubftpd_port} @PUBLICFILE_PREFIX@/publicfile/bin/ftpd ${pubftpd_root} 2>&1 | @DAEMONTOOLS_PREFIX@/bin/setuidgid publog ${pubftpd_logcmd}" + command_args="&" + rc_flags="" +} + +if [ -f /etc/rc.subr ]; then + load_rc_config $name + run_rc_command "$1" +else + @ECHO_N@ " ${name}" + pubftpd_precmd + eval ${command} ${pubftpd_flags} ${command_args} +fi diff --git a/net/publicfile-run/files/pubhttpd.sh b/net/publicfile-run/files/pubhttpd.sh new file mode 100644 index 00000000000..769a4764000 --- /dev/null +++ b/net/publicfile-run/files/pubhttpd.sh @@ -0,0 +1,57 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: pubhttpd.sh,v 1.1 2015/01/27 23:01:31 schmonz Exp $ +# +# @PKGNAME@ script to control publicfile httpd (HTTP server) +# + +# PROVIDE: pubhttpd +# REQUIRE: NETWORKING mountcritremote syslogd +# BEFORE: DAEMON + +name="pubhttpd" + +# User-settable rc.conf variables and their default values: +: ${pubhttpd_root:="@VARBASE@/public"} +: ${pubhttpd_postenv:=""} +: ${pubhttpd_datalimit:="50000"} +: ${pubhttpd_localname:="0"} +: ${pubhttpd_backlog:="50"} +: ${pubhttpd_conlimit:="100"} +: ${pubhttpd_host:="0"} +: ${pubhttpd_port:="80"} +: ${pubhttpd_log:="YES"} +: ${pubhttpd_logcmd:="logger -t nb${name} -p ftp.info"} +: ${pubhttpd_nologcmd:="@DAEMONTOOLS_PREFIX@/bin/multilog -*"} + +if [ -f /etc/rc.subr ]; then + . /etc/rc.subr +fi + +rcvar=${name} +required_dirs="${pubhttpd_root}" +command="@UCSPI_TCP_PREFIX@/bin/tcpserver" +procname=${name} +start_precmd="pubhttpd_precmd" + +pubhttpd_precmd() +{ + # tcpserver(1) is akin to inetd(8), but runs one service per process. + # We want to signal only the tcpserver process responsible for the HTTP + # service. Use argv0(1) to set the process name to "pubhttpd". + if [ -f /etc/rc.subr ]; then + checkyesno pubhttpd_log || pubhttpd_logcmd=${pubhttpd_nologcmd} + fi + command="@SETENV@ - ${pubhttpd_postenv} @DAEMONTOOLS_PREFIX@/bin/envuidgid pubhttp @DAEMONTOOLS_PREFIX@/bin/softlimit -o20 -d${pubhttpd_datalimit} @UCSPI_TCP_PREFIX@/bin/argv0 @UCSPI_TCP_PREFIX@/bin/tcpserver ${name} -vDRH -l${pubhttpd_localname} -b${pubhttpd_backlog} -c${pubhttpd_conlimit} ${pubhttpd_host} ${pubhttpd_port} @PUBLICFILE_PREFIX@/publicfile/bin/httpd ${pubhttpd_root} 2>&1 | @DAEMONTOOLS_PREFIX@/bin/setuidgid publog ${pubhttpd_logcmd}" + command_args="&" + rc_flags="" +} + +if [ -f /etc/rc.subr ]; then + load_rc_config $name + run_rc_command "$1" +else + @ECHO_N@ " ${name}" + pubhttpd_precmd + eval ${command} ${pubhttpd_flags} ${command_args} +fi |