aboutsummaryrefslogtreecommitdiffstats
path: root/testing/pure-ftpd/pure-ftpd.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-03-31 12:25:20 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-03-31 12:26:10 +0000
commitea6f37407162790ebc283d23bf7edb2812aea647 (patch)
treecafc40c381432cc681b080a383821105efbfedbf /testing/pure-ftpd/pure-ftpd.initd
parent7faef200060e1a0e2f098a349bf6c1ea9a7dcb5d (diff)
downloadaports-ea6f37407162790ebc283d23bf7edb2812aea647.tar.bz2
aports-ea6f37407162790ebc283d23bf7edb2812aea647.tar.xz
testing/pure-ftpd: rename dir and use gentoo init.d scripts
Diffstat (limited to 'testing/pure-ftpd/pure-ftpd.initd')
-rw-r--r--testing/pure-ftpd/pure-ftpd.initd71
1 files changed, 71 insertions, 0 deletions
diff --git a/testing/pure-ftpd/pure-ftpd.initd b/testing/pure-ftpd/pure-ftpd.initd
new file mode 100644
index 0000000000..768c565efd
--- /dev/null
+++ b/testing/pure-ftpd/pure-ftpd.initd
@@ -0,0 +1,71 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-ftp/pure-ftpd/files/pure-ftpd.rc10,v 1.1 2010/08/19 08:07:13 polynomial-c Exp $
+
+ftpd_pidfile="/var/run/pure-ftpd.pid"
+script_pidfile="/var/run/pure-uploadscript.pid"
+ftpd_rundir="/var/lib/run/pure-ftpd"
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ -z "$IS_CONFIGURED" ] ; then
+ eerror "You need to setup /etc/conf.d/pure-ftpd first!"
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+
+ if ${TMPFS_MOUNT:-false} && grep -q tmpfs /proc/filesystems ; then
+ [ -n "${TMPFS_OPTS}" ] && MOUNT_OPTS="-o ${TMPFS_OPTS}"
+ einfo "Mounting tmpfs on ${ftpd_rundir}"
+ mount ${MOUNT_OPTS} -t tmpfs tmpfs ${ftpd_rundir} \
+ || eerror "Unable to mount tmpfs"
+ fi
+
+ # only works with openrc
+ WAIT=""
+ if [ -f /etc/init.d/sysfs ]; then
+ WAIT="--wait 100"
+ fi
+
+ UPSCRIPT=""
+ OKNODO=""
+ if [ -n "$UPLOADSCRIPT" ] ; then
+ UPSCRIPT="--uploadscript"
+ OKNODO="--oknodo"
+ fi
+ ebegin "Starting Pure-FTPd"
+ start-stop-daemon --start --quiet --pidfile ${ftpd_pidfile} $OKNODO --exec /usr/sbin/pure-ftpd ${WAIT} -- --pidfile ${ftpd_pidfile} $SERVER $MAX_CONN $MAX_CONN_IP $DAEMON $DISK_FULL $USE_NAT $AUTH $LOG $TIMEOUT $CHARCONV $MISC_OTHER $UPSCRIPT
+ result=$?
+ if [ $result -ne 0 ] ; then
+ eend 1 "Could not launch Pure-FTPd"
+ else
+ eend $result
+ if [ -n "$UPLOADSCRIPT" ] ; then
+ ebegin "Starting Pure-FTPd upload script"
+ start-stop-daemon --start --quiet --make-pidfile --pidfile ${script_pidfile} --exec /usr/sbin/pure-uploadscript --background ${WAIT} -- -r $UPLOADSCRIPT
+ eend $?
+ fi
+ fi
+}
+
+stop() {
+ ebegin "Stopping Pure-FTPd"
+ start-stop-daemon --stop --retry 20 --quiet --pidfile ${ftpd_pidfile}
+ eend $?
+ if [ -n "$UPLOADSCRIPT" ] ; then
+ ebegin "Stopping Pure-FTPd upload script"
+ start-stop-daemon --stop --retry 20 --quiet --pidfile ${script_pidfile}
+ eend $?
+ fi
+
+ if ${TMPFS_MOUNT:-false} && mount | grep -q ${ftpd_rundir} ; then
+ umount ${ftpd_rundir} >/dev/null 2>&1
+ fi
+}