Mail archive
alpine-aports

[alpine-aports] [PATCH] main/spawn-fcgi: fix dealing with unix sockets

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Thu, 16 Feb 2017 03:43:10 +0200

fix collision when both socket and tcp_port are set up
cleanups in APKBUILD and confd
---
 main/spawn-fcgi/APKBUILD         | 40 +++++++++++++++-------------------------
 main/spawn-fcgi/spawn-fcgi.confd | 22 +++++++++++-----------
 main/spawn-fcgi/spawn-fcgi.initd | 19 +++++++++----------
 3 files changed, 35 insertions(+), 46 deletions(-)
diff --git a/main/spawn-fcgi/APKBUILD b/main/spawn-fcgi/APKBUILD
index 06533159ab..b9b96dc54d 100644
--- a/main/spawn-fcgi/APKBUILD
+++ b/main/spawn-fcgi/APKBUILD
_at_@ -1,45 +1,35 @@
 # Maintainer: Eivind Uggedal <eivind_at_uggedal.com>
+# Contributor: Valery Kartel <valery.kartel_at_gmail.com>
 pkgname=spawn-fcgi
 pkgver=1.6.4
-pkgrel=1
+pkgrel=2
 pkgdesc="Spawn FastCGI applications"
 url="http://redmine.lighttpd.net/projects/spawn-fcgi/"
 arch="all"
 license="BSD"
 depends=""
-depends_dev=""
-makedepends="$depends_dev"
-install=""
+makedepends=""
 subpackages="$pkgname-doc"
 source="http://www.lighttpd.net/download/$pkgname-$pkgver.tar.bz2
-	spawn-fcgi.confd
-	spawn-fcgi.initd
-"
-
-_builddir="$srcdir"/$pkgname-$pkgver
+	$pkgname.confd
+	$pkgname.initd
+	"
+builddir="$srcdir/$pkgname-$pkgver"
 
 build() {
-	cd "$_builddir"
-	./configure --prefix=/usr && \
-		make
+	cd "$builddir"
+	./configure --prefix=/usr || return 1
+	make || return 1
 }
 
 package() {
-	cd "$_builddir"
+	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
+	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
 }
 
-md5sums="bf269849995ab8b3a8989779fa5818aa  spawn-fcgi-1.6.4.tar.bz2
-42da2b0171adc061feafd07c4986f4bb  spawn-fcgi.confd
-ba72173b3d2ba32822a5241f90097650  spawn-fcgi.initd"
-sha256sums="a3cfc7c9581b6ddc31084b379c9160323fa345d357ace6cd2d3d3af3593e2873  spawn-fcgi-1.6.4.tar.bz2
-40719f81ae37421948592b379ff37d9144c728cc7a57042df8f469835c90fe03  spawn-fcgi.confd
-210ac4e64c8fdc9efa19b3bfe6ab51b2ab0690afedd01f4dd205339c688bfa77  spawn-fcgi.initd"
 sha512sums="defe3b0e21952f6a852237f4677b446757bd0dbccc6609beb2094c59b12de7814a76525554731ad3b52d10060bb0b4060b4f5c4fc3e14cd35f59c30cc583b6b9  spawn-fcgi-1.6.4.tar.bz2
-d6a3020ea440366f5dc6a0ec36e0807817537859b1ec5f47d5f2e584d66e5d241cd7989992bac86c1e253ba3358155d93712d0e534c973e0603d9cc7df6544b0  spawn-fcgi.confd
-f80d9f9e21659da4a8cb2dfacc24678229df066116585f2031f0f55955b1d29a24b94b1076fc0f65b7892aa27d149af5352231bade0bc0b945bd94999321d71a  spawn-fcgi.initd"
+44fdc908b868d890713b1eee8f8f5a7ff1a26d0665aa368e76587d479934bbda0a3e4ccd53953fef524103630261c40495cd58963fdea11a47e2cd0f23e1dcf6  spawn-fcgi.confd
+c6b44dbdac2ac53d7c26acfa1d433dd81d12fce35e9ba0c7d1341e5da16c6453fdd65de073b22a091b425799b01f08385b3293e33f505d4c26764826e5ab9084  spawn-fcgi.initd"
diff --git a/main/spawn-fcgi/spawn-fcgi.confd b/main/spawn-fcgi/spawn-fcgi.confd
index b5a6ed5028..62712fb36c 100644
--- a/main/spawn-fcgi/spawn-fcgi.confd
+++ b/main/spawn-fcgi/spawn-fcgi.confd
_at_@ -14,45 +14,45 @@
 # Leave empty to use an IP socket (default). See below. Enabling this,
 # disables the IP socket.
 #
-FCGI_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
+#FCGI_ADDRESS=
 
 # 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.
+# The default is 1234 if FCGI_SOCKET is not set
 #
-FCGI_PORT=1234
+#FCGI_PORT=
 
 # 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=
+#FCGI_PROGRAM=
 
 # The number of child processes to spawn. The default is 1.
 #
-FCGI_CHILDREN=1
+#FCGI_CHILDREN=
 
 # If you want to run your application inside a chroot then specify the
 # directory here. Leave this blank otherwise.
 #
-FCGI_CHROOT=
+#FCGI_CHROOT=
 
 # If you want to run your application from a specific directiory specify
 # it here. Leave this blank otherwise.
 #
-FCGI_CHDIR=
+#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=
+#FCGI_USER=
+#FCGI_GROUP=
 
 # Additional options you might want to pass to spawn-fcgi
 #
_at_@ -61,7 +61,7 @@ FCGI_GROUP=
 # If your application requires additional environment variables, you may
 # specify them here. See PHP example below.
 #
-ALLOWED_ENV="PATH"
+#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
diff --git a/main/spawn-fcgi/spawn-fcgi.initd b/main/spawn-fcgi/spawn-fcgi.initd
index b33952939c..4571a15d28 100644
--- a/main/spawn-fcgi/spawn-fcgi.initd
+++ b/main/spawn-fcgi/spawn-fcgi.initd
_at_@ -1,7 +1,4 @@
 #!/sbin/openrc-run
-# 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
_at_@ -28,13 +25,6 @@ start() {
 		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."
_at_@ -49,10 +39,19 @@ start() {
 		return 1
 	fi
 
+	if [ -z "${FCGI_PORT}" ]; then
+		FCGI_PORT=1234
+	fi
+
 	if [ -z "${FCGI_ADDRESS}" ]; then
 		FCGI_ADDRESS=127.0.0.1
 	fi
 
+	if [ ! -z "${FCGI_SOCKET}" ]; then
+		unset FCGI_PORT
+		unset FCGI_ADDRESS
+	fi
+
 	if [ -z "${FCGI_CHILDREN}" ]; then
 		FCGI_CHILDREN=1
 	fi
-- 
2.11.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Thu Feb 16 2017 - 03:43:10 GMT