1 |
commit: 0e087bd09a7b0d4737e26c876720a596ed002d28 |
2 |
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 14 08:43:27 2018 +0000 |
4 |
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 14 10:18:04 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e087bd0 |
7 |
|
8 |
www-servers/spawn-fcgi: Several fixes to init.d script |
9 |
|
10 |
- Detect crashes (#567320 by Cédric Krier) |
11 |
- Use proper variable names (#657362 by Jernej Simoncic) |
12 |
|
13 |
Closes: https://bugs.gentoo.org/567320 |
14 |
Closes: https://bugs.gentoo.org/657362 |
15 |
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org> |
16 |
Package-Manager: Portage-2.3.51, Repoman-2.3.11 |
17 |
|
18 |
www-servers/spawn-fcgi/files/spawn-fcgi.initd-r3 | 116 ++++++++++++++++++++++ |
19 |
www-servers/spawn-fcgi/spawn-fcgi-1.6.4-r1.ebuild | 33 ++++++ |
20 |
2 files changed, 149 insertions(+) |
21 |
|
22 |
diff --git a/www-servers/spawn-fcgi/files/spawn-fcgi.initd-r3 b/www-servers/spawn-fcgi/files/spawn-fcgi.initd-r3 |
23 |
new file mode 100644 |
24 |
index 00000000000..ef680aad277 |
25 |
--- /dev/null |
26 |
+++ b/www-servers/spawn-fcgi/files/spawn-fcgi.initd-r3 |
27 |
@@ -0,0 +1,116 @@ |
28 |
+#!/sbin/openrc-run |
29 |
+# Copyright 1999-2018 Gentoo Authors |
30 |
+# Distributed under the terms of the GNU General Public License v2 |
31 |
+ |
32 |
+PROGNAME=${SVCNAME#*.} |
33 |
+SPAWNFCGI=/usr/bin/spawn-fcgi |
34 |
+PIDPATH=/run/spawn-fcgi |
35 |
+PIDFILE=${PIDPATH}/${PROGNAME} |
36 |
+ |
37 |
+depend() { |
38 |
+ need net |
39 |
+} |
40 |
+ |
41 |
+start() { |
42 |
+ local X E OPTIONS i RETVAL FCGI_PROGRAM_EXEC |
43 |
+ FCGI_PROGRAM_EXEC=$(echo ${FCGI_PROGRAM} | awk "{print \$1}") |
44 |
+ |
45 |
+ if [ "${SVCNAME}" = "spawn-fcgi" ]; then |
46 |
+ eerror "You are not supposed to run this script directly. Create a symlink" |
47 |
+ eerror "for the FastCGI application you want to run as well as a copy of the" |
48 |
+ eerror "configuration file and modify it appropriately like so..." |
49 |
+ eerror |
50 |
+ eerror " ln -s spawn-fcgi /etc/init.d/spawn-fcgi.trac" |
51 |
+ eerror " cp /etc/conf.d/spawn-fcgi /etc/conf.d/spawn-fcgi.trac" |
52 |
+ eerror " `basename "${EDITOR}"` /etc/conf.d/spawn-fcgi.trac" |
53 |
+ eerror |
54 |
+ return 1 |
55 |
+ fi |
56 |
+ |
57 |
+ if [ ! -z "${FCGI_SOCKET}" ] && [ ! -z "${FCGI_PORT}" ]; then |
58 |
+ eerror "Only one of the two may be defined:" |
59 |
+ eerror " FCGI_SOCKET=${FCGI_SOCKET}" |
60 |
+ eerror " FCGI_PORT=${FCGI_PORT}" |
61 |
+ return 1 |
62 |
+ fi |
63 |
+ |
64 |
+ if [ -z "${FCGI_PROGRAM}" ]; then |
65 |
+ eerror "You need to specify which \$FCGI_PROGRAM" |
66 |
+ eerror "you want to start." |
67 |
+ eerror "Please adjust /etc/conf.d/spawn-fcgi.${PROGNAME}" |
68 |
+ return 1 |
69 |
+ fi |
70 |
+ |
71 |
+ if [ ! -x "${FCGI_PROGRAM_EXEC}" ]; then |
72 |
+ eerror "The file specified as \$FCGI_PROGRAM" |
73 |
+ eerror "does not exist or is not executable." |
74 |
+ eerror "Please adjust /etc/conf.d/spawn-fcgi.${PROGNAME}" |
75 |
+ return 1 |
76 |
+ fi |
77 |
+ |
78 |
+ if [ -z "${FCGI_ADDRESS}" ]; then |
79 |
+ FCGI_ADDRESS=127.0.0.1 |
80 |
+ fi |
81 |
+ |
82 |
+ if [ -z "${FCGI_CHILDREN}" ]; then |
83 |
+ FCGI_CHILDREN=1 |
84 |
+ fi |
85 |
+ |
86 |
+ if [ -n "${FCGI_CHROOT}" ]; then |
87 |
+ OPTIONS="${OPTIONS} -c ${FCGI_CHROOT}" |
88 |
+ fi |
89 |
+ |
90 |
+ if [ -n "${FCGI_CHDIR}" ]; then |
91 |
+ OPTIONS="${OPTIONS} -d ${FCGI_CHDIR}" |
92 |
+ fi |
93 |
+ |
94 |
+ if [ -n "${FCGI_USER}" ] && [ "${FCGI_USER}" != "root" ]; then |
95 |
+ OPTIONS="${OPTIONS} -u ${FCGI_USER}" |
96 |
+ fi |
97 |
+ |
98 |
+ if [ -n "${FCGI_GROUP}" ] && [ "${FCGI_GROUP}" != "root" ]; then |
99 |
+ OPTIONS="${OPTIONS} -g ${FCGI_GROUP}" |
100 |
+ fi |
101 |
+ |
102 |
+ if [ -n "${FCGI_EXTRA_OPTIONS}" ]; then |
103 |
+ OPTIONS="${OPTIONS} ${FCGI_EXTRA_OPTIONS}" |
104 |
+ fi |
105 |
+ |
106 |
+ unset E |
107 |
+ for i in ${ALLOWED_ENV}; do |
108 |
+ local j |
109 |
+ eval j=$(echo \$"$i") |
110 |
+ [ -n "${j}" ] && E="${E} --env ${i}=${j}" |
111 |
+ done |
112 |
+ |
113 |
+ ebegin "Starting FastCGI application ${PROGNAME}" |
114 |
+ checkpath -q -d -m 700 /run/spawn-fcgi |
115 |
+ X=0 |
116 |
+ while [ $X -lt ${FCGI_CHILDREN} ]; do |
117 |
+ X=$(($X+1)) |
118 |
+ local P SOCKET_OPTION INET_OPTION |
119 |
+ P=${PIDFILE}-${X}.pid |
120 |
+ [ -n "${FCGI_SOCKET}" ] && SOCKET_OPTION="-s ${FCGI_SOCKET}-${X}" |
121 |
+ [ -n "${FCGI_PORT}" ] && INET_OPTION="-a ${FCGI_ADDRESS} -p $((${FCGI_PORT} + ${X} - 1))" |
122 |
+ |
123 |
+ start-stop-daemon --start --pidfile ${P} --exec ${SPAWNFCGI} \ |
124 |
+ ${E} -- ${SOCKET_OPTION} ${INET_OPTION} \ |
125 |
+ -P ${P} ${OPTIONS} -- ${FCGI_PROGRAM} |
126 |
+ RETVAL=$? |
127 |
+ |
128 |
+ # Stop on error. Don't want to spawn a mess! |
129 |
+ [ "${RETVAL}" != "0" ] && break |
130 |
+ done |
131 |
+ eend ${RETVAL} |
132 |
+} |
133 |
+ |
134 |
+stop() { |
135 |
+ local X RETVAL=0 |
136 |
+ |
137 |
+ ebegin "Stopping FastCGI application ${PROGNAME}" |
138 |
+ for X in ${PIDFILE}-[0-9]*.pid ; do |
139 |
+ start-stop-daemon --stop --pidfile ${X} || \ |
140 |
+ { RETVAL=$? && break ; } |
141 |
+ done |
142 |
+ eend ${RETVAL} |
143 |
+} |
144 |
|
145 |
diff --git a/www-servers/spawn-fcgi/spawn-fcgi-1.6.4-r1.ebuild b/www-servers/spawn-fcgi/spawn-fcgi-1.6.4-r1.ebuild |
146 |
new file mode 100644 |
147 |
index 00000000000..92e2c3777b5 |
148 |
--- /dev/null |
149 |
+++ b/www-servers/spawn-fcgi/spawn-fcgi-1.6.4-r1.ebuild |
150 |
@@ -0,0 +1,33 @@ |
151 |
+# Copyright 1999-2018 Gentoo Authors |
152 |
+# Distributed under the terms of the GNU General Public License v2 |
153 |
+ |
154 |
+EAPI=7 |
155 |
+ |
156 |
+DESCRIPTION="A FCGI spawner for lighttpd and cherokee and other webservers" |
157 |
+HOMEPAGE="http://redmine.lighttpd.net/projects/spawn-fcgi" |
158 |
+SRC_URI="http://www.lighttpd.net/download/${P}.tar.xz" |
159 |
+ |
160 |
+LICENSE="BSD GPL-2" |
161 |
+SLOT="0" |
162 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sh ~sparc ~x86" |
163 |
+IUSE="ipv6" |
164 |
+ |
165 |
+DEPEND="" |
166 |
+RDEPEND=" |
167 |
+ !<=www-servers/lighttpd-1.4.20 |
168 |
+ !<=www-servers/cherokee-0.98.1 |
169 |
+" |
170 |
+ |
171 |
+src_configure() { |
172 |
+ econf $(use_enable ipv6) |
173 |
+} |
174 |
+ |
175 |
+src_install() { |
176 |
+ default |
177 |
+ |
178 |
+ newconfd "${FILESDIR}"/spawn-fcgi.confd spawn-fcgi |
179 |
+ newinitd "${FILESDIR}"/spawn-fcgi.initd-r3 spawn-fcgi |
180 |
+ |
181 |
+ docinto examples |
182 |
+ dodoc doc/run-generic doc/run-php doc/run-rails |
183 |
+} |