aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorEivind Uggedal <eivind@uggedal.com>2014-07-28 12:15:17 +0000
committerEivind Uggedal <eivind@uggedal.com>2014-07-28 12:19:14 +0000
commit6b8500740c53166c4a655cff2cc068b12be3e709 (patch)
tree03322bd254472434cfcb4d434a3f7a68ca16b262 /testing
parent7cbbbe619130bf20ae9b9c49892c1fb8eb19a1af (diff)
downloadaports-6b8500740c53166c4a655cff2cc068b12be3e709.tar.bz2
aports-6b8500740c53166c4a655cff2cc068b12be3e709.tar.xz
testing/spawn-fcgi: new aport
Diffstat (limited to 'testing')
-rw-r--r--testing/spawn-fcgi/APKBUILD45
-rw-r--r--testing/spawn-fcgi/spawn-fcgi.confd74
-rw-r--r--testing/spawn-fcgi/spawn-fcgi.initd117
3 files changed, 236 insertions, 0 deletions
diff --git a/testing/spawn-fcgi/APKBUILD b/testing/spawn-fcgi/APKBUILD
new file mode 100644
index 0000000000..d23ec876de
--- /dev/null
+++ b/testing/spawn-fcgi/APKBUILD
@@ -0,0 +1,45 @@
+# Maintainer: Eivind Uggedal <eivind@uggedal.com>
+pkgname=spawn-fcgi
+pkgver=1.6.4
+pkgrel=0
+pkgdesc="Spawn FastCGI applications"
+url="http://redmine.lighttpd.net/projects/spawn-fcgi/"
+arch="all"
+license="BSD"
+depends=""
+depends_dev=""
+makedepends="$depends_dev"
+install=""
+subpackages="$pkgname-doc"
+source="http://www.lighttpd.net/download/$pkgname-$pkgver.tar.bz2
+ spawn-fcgi.confd
+ spawn-fcgi.initd
+"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ cd "$_builddir"
+ ./configure --prefix=/usr && \
+ make
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install
+
+ install -D -m755 "$srcdir"/spawn-fcgi.initd \
+ "$pkgdir"/etc/init.d/spawn-fcgi
+ install -D -m644 "$srcdir"/spawn-fcgi.confd \
+ "$pkgdir"/etc/conf.d/spawn-fcgi
+}
+
+md5sums="bf269849995ab8b3a8989779fa5818aa spawn-fcgi-1.6.4.tar.bz2
+bd49e4c81fdfe34a52c8e13996b58410 spawn-fcgi.confd
+05a5355fe979f5dccfcc1f8cf4545c56 spawn-fcgi.initd"
+sha256sums="a3cfc7c9581b6ddc31084b379c9160323fa345d357ace6cd2d3d3af3593e2873 spawn-fcgi-1.6.4.tar.bz2
+562d5f9da68a3f8be53fe4432e8bcde8e2b3297e25b848c46485dfba2b8168ca spawn-fcgi.confd
+d99cba1f93bc8c7b54fd763281260f0765b63b6d2fc980bed1246c9397b13d2e spawn-fcgi.initd"
+sha512sums="defe3b0e21952f6a852237f4677b446757bd0dbccc6609beb2094c59b12de7814a76525554731ad3b52d10060bb0b4060b4f5c4fc3e14cd35f59c30cc583b6b9 spawn-fcgi-1.6.4.tar.bz2
+8ca129440dc930122ae0673fb4336f7338bc941c4c2b0e4086a72e56181a25136db7c18b523f5a6a99a393bde53b4f01fc528067186cdc61c484c0cad641366a spawn-fcgi.confd
+5030efb495f19e833d4a53e99e860fac51ebfc43f3b59916bab1bee103e188dd0cf1a383fb3282101eb97279ead8054fa7ffb28ac2eaa34e94780e4125a87e06 spawn-fcgi.initd"
diff --git a/testing/spawn-fcgi/spawn-fcgi.confd b/testing/spawn-fcgi/spawn-fcgi.confd
new file mode 100644
index 0000000000..b5a6ed5028
--- /dev/null
+++ b/testing/spawn-fcgi/spawn-fcgi.confd
@@ -0,0 +1,74 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/spawn-fcgi/files/spawn-fcgi.confd,v 1.6 2009/09/28 08:38:02 bangert Exp $
+
+# DO NOT MODIFY THIS FILE DIRECTLY! CREATE A COPY AND MODIFY THAT INSTEAD!
+
+# The FCGI process can be made available through a filesystem socket or
+# through a inet socket. One and only one of the two types must be choosen.
+# Default is the inet socket.
+
+# The filename specified by
+# FCGI_SOCKET will be suffixed with a number for each child process, for
+# example, fcgi.socket-1.
+# Leave empty to use an IP socket (default). See below. Enabling this,
+# disables the IP socket.
+#
+FCGI_SOCKET=
+
+# When using FCGI_PORT, connections will only be accepted from the following
+# address. The default is 127.0.0.1. Use 0.0.0.0 to bind to all addresses.
+#
+FCGI_ADDRESS=127.0.0.1
+
+# The port specified by FCGI_PORT is the port used
+# by the first child process. If this is set to 1234 then subsequent child
+# processes will use 1235, 1236, etc.
+#
+FCGI_PORT=1234
+
+# The path to your FastCGI application. These sometimes carry the .fcgi
+# extension but not always. For PHP, you should usually point this to
+# /usr/bin/php-cgi.
+#
+#FCGI_PROGRAM=/usr/bin/php-cgi
+FCGI_PROGRAM=
+
+# The number of child processes to spawn. The default is 1.
+#
+FCGI_CHILDREN=1
+
+# If you want to run your application inside a chroot then specify the
+# directory here. Leave this blank otherwise.
+#
+FCGI_CHROOT=
+
+# If you want to run your application from a specific directiory specify
+# it here. Leave this blank otherwise.
+#
+FCGI_CHDIR=
+
+# The user and group to run your application as. If you do not specify these,
+# the application will be run as root:root.
+#
+FCGI_USER=
+FCGI_GROUP=
+
+# Additional options you might want to pass to spawn-fcgi
+#
+#FCGI_EXTRA_OPTIONS=
+
+# If your application requires additional environment variables, you may
+# specify them here. See PHP example below.
+#
+ALLOWED_ENV="PATH"
+
+# PHP ONLY :: These two options are specific to PHP. The first is the number
+# of child processes to spawn. The second is the number of requests to be
+# served by a single PHP process before it is restarted.
+#
+#PHP_FCGI_CHILDREN=5
+#PHP_FCGI_MAX_REQUESTS=500
+#
+# For this to work you would set
+# ALLOWED_ENV="PATH PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS"
diff --git a/testing/spawn-fcgi/spawn-fcgi.initd b/testing/spawn-fcgi/spawn-fcgi.initd
new file mode 100644
index 0000000000..ca54cd2aae
--- /dev/null
+++ b/testing/spawn-fcgi/spawn-fcgi.initd
@@ -0,0 +1,117 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/www-servers/spawn-fcgi/files/spawn-fcgi.initd-r2,v 1.1 2014/05/12 06:57:31 jlec Exp $
+
+PROGNAME=${SVCNAME#*.}
+SPAWNFCGI=/usr/bin/spawn-fcgi
+PIDPATH=/run/spawn-fcgi
+PIDFILE=${PIDPATH}/${PROGNAME}
+
+depend() {
+ need net
+}
+
+start() {
+ local X E OPTIONS i RETVAL FCGI_PROGRAM_EXEC
+ FCGI_PROGRAM_EXEC=$(echo ${FCGI_PROGRAM} | awk "{print \$1}")
+
+ if [ "${SVCNAME}" = "spawn-fcgi" ]; then
+ eerror "You are not supposed to run this script directly. Create a symlink"
+ eerror "for the FastCGI application you want to run as well as a copy of the"
+ eerror "configuration file and modify it appropriately like so..."
+ eerror
+ eerror " ln -s spawn-fcgi /etc/init.d/spawn-fcgi.trac"
+ eerror " cp /etc/conf.d/spawn-fcgi /etc/conf.d/spawn-fcgi.trac"
+ eerror " `basename "${EDITOR}"` /etc/conf.d/spawn-fcgi.trac"
+ eerror
+ return 1
+ fi
+
+ if [ ! -z "${FCGI_SOCKET}" ] && [ ! -z "${FCGI_PORT}" ]; then
+ eerror "Only one of the two may be defined:"
+ eerror " FCGI_SOCKET=${FCGI_SOCKET}"
+ eerror " FCGI_PORT=${FCGI_PORT}"
+ return 1
+ fi
+
+ if [ -z "${FCGI_PROGRAM}" ]; then
+ eerror "You need to specify which \$FCGI_PROGRAM"
+ eerror "you want to start."
+ eerror "Please adjust /etc/conf.d/spawn-fcgi.${PROGNAME}"
+ return 1
+ fi
+
+ if [ ! -x "${FCGI_PROGRAM_EXEC}" ]; then
+ eerror "The file specified as \$FCGI_PROGRAM"
+ eerror "does not exist or is not executable."
+ eerror "Please adjust /etc/conf.d/spawn-fcgi.${PROGNAME}"
+ return 1
+ fi
+
+ if [ -z "${FCGI_ADDRESS}" ]; then
+ FCGI_ADDRESS=127.0.0.1
+ fi
+
+ if [ -z "${FCGI_CHILDREN}" ]; then
+ FCGI_CHILDREN=1
+ fi
+
+ if [ -n "${FCGI_CHROOT}" ]; then
+ OPTIONS="${OPTIONS} -c ${FCGI_CHROOT}"
+ fi
+
+ if [ -n "${FCGI_DIR}" ]; then
+ OPTIONS="${OPTIONS} -d ${FCGI_DIR}"
+ fi
+
+ if [ -n "${FCGI_USER}" ] && [ "${FCGI_USER}" != "root" ]; then
+ OPTIONS="${OPTIONS} -u ${FCGI_USER}"
+ fi
+
+ if [ -n "${FCGI_GROUP}" ] && [ "${FCGI_GROUP}" != "root" ]; then
+ OPTIONS="${OPTIONS} -g ${FCGI_GROUP}"
+ fi
+
+ if [ -n "${FCGI_EXTRA_OPTIONS}" ]; then
+ OPTIONS="${OPTIONS} ${FCGI_EXTRA_OPTIONS}"
+ fi
+
+ unset E
+ for i in ${ALLOWED_ENV}; do
+ local j
+ eval j=$(echo \$"$i")
+ [ -n "${j}" ] && E="${E} ${i}=${j}"
+ done
+
+ ebegin "Starting FastCGI application ${PROGNAME}"
+ checkpath -q -d -m 700 /run/spawn-fcgi
+ X=0
+ while [ $X -lt ${FCGI_CHILDREN} ]; do
+ X=$(($X+1))
+ local P SOCKET_OPTION INET_OPTION
+ P=${PIDFILE}-${X}.pid
+ [ -n "${FCGI_SOCKET}" ] && SOCKET_OPTION="-s ${FCGI_SOCKET}-${X}"
+ [ -n "${FCGI_PORT}" ] && INET_OPTION="-a ${FCGI_ADDRESS} -p $((${FCGI_PORT} + ${X} - 1))"
+
+ env -i ${E} /sbin/start-stop-daemon --start --pidfile ${P} --exec ${SPAWNFCGI} \
+ --name ${FCGI_PROGRAM_EXEC} -- ${SOCKET_OPTION} ${INET_OPTION} \
+ -P ${P} ${OPTIONS} -- ${FCGI_PROGRAM}
+ RETVAL=$?
+
+ # Stop on error. Don't want to spawn a mess!
+ [ "${RETVAL}" != "0" ] && break
+ done
+ eend ${RETVAL}
+}
+
+stop() {
+ local X RETVAL=0
+
+ ebegin "Stopping FastCGI application ${PROGNAME}"
+ for X in ${PIDFILE}-[0-9]*.pid ; do
+ start-stop-daemon --stop --pidfile ${X} || \
+ { RETVAL=$? && break ; }
+ done
+ eend ${RETVAL}
+}