diff options
author | Eivind Uggedal <eivind@uggedal.com> | 2014-07-29 07:53:02 +0000 |
---|---|---|
committer | Eivind Uggedal <eivind@uggedal.com> | 2014-07-29 07:53:02 +0000 |
commit | 89b95456db418c6a7e5902243c0b6a14106ad406 (patch) | |
tree | b92eb4135ed01b4868f7b7e15e4265c2fa03bd19 /main | |
parent | 9fd7bf5a83daf1405a9782ca2661a04d4176cb52 (diff) | |
download | aports-89b95456db418c6a7e5902243c0b6a14106ad406.tar.bz2 aports-89b95456db418c6a7e5902243c0b6a14106ad406.tar.xz |
main/spawn-fcgi: moved from testing
Diffstat (limited to 'main')
-rw-r--r-- | main/spawn-fcgi/APKBUILD | 45 | ||||
-rw-r--r-- | main/spawn-fcgi/spawn-fcgi.confd | 74 | ||||
-rw-r--r-- | main/spawn-fcgi/spawn-fcgi.initd | 117 |
3 files changed, 236 insertions, 0 deletions
diff --git a/main/spawn-fcgi/APKBUILD b/main/spawn-fcgi/APKBUILD new file mode 100644 index 0000000000..f692c30f97 --- /dev/null +++ b/main/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 +42da2b0171adc061feafd07c4986f4bb spawn-fcgi.confd +05a5355fe979f5dccfcc1f8cf4545c56 spawn-fcgi.initd" +sha256sums="a3cfc7c9581b6ddc31084b379c9160323fa345d357ace6cd2d3d3af3593e2873 spawn-fcgi-1.6.4.tar.bz2 +40719f81ae37421948592b379ff37d9144c728cc7a57042df8f469835c90fe03 spawn-fcgi.confd +d99cba1f93bc8c7b54fd763281260f0765b63b6d2fc980bed1246c9397b13d2e spawn-fcgi.initd" +sha512sums="defe3b0e21952f6a852237f4677b446757bd0dbccc6609beb2094c59b12de7814a76525554731ad3b52d10060bb0b4060b4f5c4fc3e14cd35f59c30cc583b6b9 spawn-fcgi-1.6.4.tar.bz2 +d6a3020ea440366f5dc6a0ec36e0807817537859b1ec5f47d5f2e584d66e5d241cd7989992bac86c1e253ba3358155d93712d0e534c973e0603d9cc7df6544b0 spawn-fcgi.confd +5030efb495f19e833d4a53e99e860fac51ebfc43f3b59916bab1bee103e188dd0cf1a383fb3282101eb97279ead8054fa7ffb28ac2eaa34e94780e4125a87e06 spawn-fcgi.initd" diff --git a/main/spawn-fcgi/spawn-fcgi.confd b/main/spawn-fcgi/spawn-fcgi.confd new file mode 100644 index 0000000000..b5a6ed5028 --- /dev/null +++ b/main/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/main/spawn-fcgi/spawn-fcgi.initd b/main/spawn-fcgi/spawn-fcgi.initd new file mode 100644 index 0000000000..ca54cd2aae --- /dev/null +++ b/main/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} +} |