Fix cgiwrap script for nginx.

atratsevskiy
Mike Hiretsky 13 years ago
parent a58a92a132
commit 03b29e869e

@ -2,6 +2,12 @@
# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/ChangeLog,v 1.289 2011/09/09 16:44:14 hollow Exp $
*nginx-1.1.2-r12 (06 Oct 2011)
06 Oct 2011; Mike Hiretsky (mhiretskiy) <mh@calculate.ru>
+nginx-1.1.2-r12.ebuild, files/cgiwrap-fcgi.pl:
Update cgiwrap script
*nginx-1.1.2-r10 (04 Oct 2011)
04 Oct 2011; Mike Hiretsky (mhiretskiy) <mh@calculate.ru>

@ -1,5 +1,5 @@
AUX cgiwrap-fcgi.init 659 RMD160 8740bcc05a0911a58dc470e6b455d8a452d31584 SHA1 853d8bdb044c4cddd7fa86f4700fa5a8fb297477 SHA256 e2e508255b764679b7c564bf42d2da6d56428387fbb91fa123d0a7815dd7e3fb
AUX cgiwrap-fcgi.pl 3387 RMD160 5f73d72e4812ce991de31c4ce75a100151b0c324 SHA1 6c8ec601db9c83f2281aa7c822143b4d47a31e9e SHA256 2ec28a105e7df07ff14b4b8558e9cbf42491bb457f39d4a3f4c6a741ff443091
AUX cgiwrap-fcgi.pl 3384 RMD160 3b656ee64cb0f63a2033482fec5ecb3425cea943 SHA1 4ef7e281b01360a8e7d6531795c0eb65fd5c0bb7 SHA256 837d4a59bc8e76848e0b2b3120833dc494bc6f297e33e75089ebd35a35977d7d
AUX nginx.conf-r4 1358 RMD160 a948df249a16be86c114d587cfa5ee570d84a356 SHA1 e9db0447a1beb326a0858cf8189328229d1d3edf SHA256 6ff6c9301ea2a4d74a335b9119d7f9dba87d4e83793cf22d837d49f061763096
AUX nginx.init-r2 1827 RMD160 2ece9278fd4a3ca948106e024c2607fca02e2599 SHA1 76af70e8fcad8b298851382d18160d11dc3e2cca SHA256 89801c2e0ea3480380dedfbc84b0cc993ab6b93768886246a22e650ba0a61798
AUX nginx.logrotate 364 RMD160 9fdfd2ea2f49b8dba20a030d893e34779bb32364 SHA1 4ab07992fa5c64f753e3643e1b51fcab4dec6ccf SHA256 9e3e090dfd10861d5f9b279e19113ce8d05caf9f33d488f6aabf9f19ac0cf925
@ -13,5 +13,6 @@ DIST ngx_slowfs_cache-1.6.tar.gz 10972 RMD160 e1d10851db4a55fc465665caa3f6989d14
DIST ngx_upload_progress-0.8.2.tar.gz 16559 RMD160 3aadb9bf9b15b3810d1acb466d331ea5bdae6062 SHA1 cbff2734cccc3ac93b3422a9a01547af29f9c11d SHA256 cab70d2e300cfa0d9d7d3b34bf27810533ecbf11dddcd5078a4754cfab337c95
DIST passenger-3.0.8.tar.gz 2362561 RMD160 1264b76a3440492b3d435050007611735a627c72 SHA1 265d1dcb66a29b944fa475f7d6831ce16ac37e2e SHA256 ccef21dc97b54de17c1d44644b2bc67b7732a860ff67206a4c557727311a8349
EBUILD nginx-1.1.2-r11.ebuild 11583 RMD160 2a665bc67d49f085baafeb6cb9f2a5a2d6e2e01d SHA1 4953dbe3dbac29022cdb61a0df1cdd51f490fcb5 SHA256 0a8aa9f49bc1b3a63f7b4d1c2b3b26bec8223d447516cc25b4d12abc6eb64c12
MISC ChangeLog 47899 RMD160 2fd3f3a9466abcb048d5155cd5c6987a94c69bdf SHA1 aeb5bdc8a5072b0b1fe14cf16334904b0cc86af4 SHA256 1527b46149d4bc47deaf3d4003e2aa54b4207c86a56b25b20e9ff3be962e05ca
EBUILD nginx-1.1.2-r12.ebuild 11583 RMD160 2a665bc67d49f085baafeb6cb9f2a5a2d6e2e01d SHA1 4953dbe3dbac29022cdb61a0df1cdd51f490fcb5 SHA256 0a8aa9f49bc1b3a63f7b4d1c2b3b26bec8223d447516cc25b4d12abc6eb64c12
MISC ChangeLog 48066 RMD160 4345372e01882914b5139dec2725ea79d6e0cc81 SHA1 4c4b381ec65c74ea1a3666617e62a353f634a2f8 SHA256 f0646085338da695c2f6e2e59403fe676c1ba297eb3dc455a09844b6c78411bb
MISC metadata.xml 2402 RMD160 fee632a79ad08ef0fe36cd73d718a81348d71370 SHA1 12b7d3eac7a8e9f99dbe2b64bc288aa5e3f4608c SHA256 f133dca88780f2716797c5d2fc309466013d35b3dccf752ab27fb4ee399c6e47

@ -30,8 +30,8 @@ sub daemonize() {
sub main {
$proc_manager = new FCGI::ProcManager({ n_processes => $PROCESSES, die_timeout => 10 }); #!!!
$socket = FCGI::OpenSocket( "/var/run/nginx/cgiwrap-dispatch.sock", 10 ); #use UNIX sockets - user running this script must have w access to the 'nginx' folder!!
`/bin/chown nginx:nginx /var/run/nginx/cgiwrap-dispatch.sock`;
$socket = FCGI::OpenSocket( "/var/run/cgiwrap-dispatch.sock", 10 ); #use UNIX sockets - user running this script must have w access to the 'nginx' folder!!
`/bin/chown nginx:nginx /var/run/cgiwrap-dispatch.sock`;
$request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%req_params, $socket, FCGI::FAIL_ACCEPT_ON_INTR );
open(FPID, "> /var/run/cgiwrap.pid");
print(FPID $$);
@ -91,8 +91,9 @@ sub request_loop {
syscall(&SYS_dup2, fileno(CHILD_RD), 0);
#open(STDIN, "<&CHILD_RD");
my $SCRIPTUSER = $req_params{SCRIPT_USER} or "";
if($SCRIPTUSER eq "")
if($SCRIPTUSER eq "") {
exec($req_params{SCRIPT_FILENAME});
}
else {
exec("su -c \"$req_params{SCRIPT_FILENAME}\" -s /bin/sh ${SCRIPTUSER}");
}

@ -0,0 +1,360 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/nginx-1.1.2.ebuild,v 1.2 2011/09/09 16:44:14 hollow Exp $
EAPI="4"
USE_RUBY="ruby18"
# Maintainer notes:
# - http_rewrite-independent pcre-support makes sense for matching locations without an actual rewrite
# - any http-module activates the main http-functionality and overrides USE=-http
# - keep the following requirements in mind before adding external modules:
# * alive upstream
# * sane packaging
# * builds cleanly
# * does not need a patch for nginx core
# - TODO: test the google-perftools module (included in vanilla tarball)
# prevent perl-module from adding automagic perl DEPENDs
GENTOO_DEPEND_ON_PERL="no"
# http_uploadprogress (https://github.com/masterzen/nginx-upload-progress-module, BSD-2 license)
HTTP_UPLOAD_PROGRESS_MODULE_PV="0.8.2"
HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
HTTP_UPLOAD_PROGRESS_MODULE_SHA1="8b55a34"
HTTP_UPLOAD_PROGRESS_MODULE_URI="http://github.com/masterzen/nginx-upload-progress-module/tarball/v${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
# http_headers_more (http://github.com/agentzh/headers-more-nginx-module, BSD license)
HTTP_HEADERS_MORE_MODULE_PV="0.15"
HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}"
HTTP_HEADERS_MORE_MODULE_SHA1="137855d"
HTTP_HEADERS_MORE_MODULE_URI="http://github.com/agentzh/headers-more-nginx-module/tarball/v${HTTP_HEADERS_MORE_MODULE_PV}"
# http_push (http://pushmodule.slact.net/, MIT license)
HTTP_PUSH_MODULE_PV="0.692"
HTTP_PUSH_MODULE_P="nginx_http_push_module-${HTTP_PUSH_MODULE_PV}"
HTTP_PUSH_MODULE_URI="http://pushmodule.slact.net/downloads/${HTTP_PUSH_MODULE_P}.tar.gz"
# http_cache_purge (http://labs.frickle.com/nginx_ngx_cache_purge/, BSD-2 license)
HTTP_CACHE_PURGE_MODULE_PV="1.3"
HTTP_CACHE_PURGE_MODULE_P="ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
HTTP_CACHE_PURGE_MODULE_URI="http://labs.frickle.com/files/${HTTP_CACHE_PURGE_MODULE_P}.tar.gz"
# HTTP Upload module from Valery Kholodkov
# (http://www.grid.net.ru/nginx/upload.en.html, BSD license)
HTTP_UPLOAD_MODULE_PV="2.2.0"
HTTP_UPLOAD_MODULE_P="nginx_upload_module-${HTTP_UPLOAD_MODULE_PV}"
HTTP_UPLOAD_MODULE_URI="http://www.grid.net.ru/nginx/download/${HTTP_UPLOAD_MODULE_P}.tar.gz"
# http_slowfs_cache (http://labs.frickle.com/nginx_ngx_slowfs_cache/, BSD-2 license)
HTTP_SLOWFS_CACHE_MODULE_PV="1.6"
HTTP_SLOWFS_CACHE_MODULE_P="ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
HTTP_SLOWFS_CACHE_MODULE_URI="http://labs.frickle.com/files/${HTTP_SLOWFS_CACHE_MODULE_P}.tar.gz"
HTTP_PASSENGER_MODULE_PV="3.0.8"
HTTP_PASSENGER_MODULE_P="passenger-${HTTP_PASSENGER_MODULE_PV}"
HTTP_PASSENGER_MODULE_URI="mirror://rubyforge/passenger/${HTTP_PASSENGER_MODULE_P}.tar.gz"
inherit eutils ssl-cert toolchain-funcs perl-module flag-o-matic ruby-ng
DESCRIPTION="Robust, small and high performance http and reverse proxy server"
HOMEPAGE="http://nginx.org"
SRC_URI="http://nginx.org/download/${P}.tar.gz
nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
nginx_modules_http_push? ( ${HTTP_PUSH_MODULE_URI} )
nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} )
nginx_modules_http_passenger? ( ${HTTP_PASSENGER_MODULE_URI} )
nginx_modules_http_upload? ( ${HTTP_UPLOAD_MODULE_URI} )
nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} )"
LICENSE="as-is BSD BSD-2 GPL-2 MIT"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86 ~x86-fbsd"
NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif fastcgi
geo gzip limit_req limit_zone map memcached proxy referer rewrite scgi ssi
split_clients upstream_ip_hash userid uwsgi"
NGINX_MODULES_OPT="addition dav degradation flv geoip gzip_static image_filter
perl random_index realip secure_link stub_status sub xslt"
NGINX_MODULES_MAIL="imap pop3 smtp"
NGINX_MODULES_3RD="
http_upload_progress
http_headers_more
http_passenger
http_push
http_cache_purge
http_upload
http_slowfs_cache"
IUSE="aio debug +http +http-cache ipv6 libatomic +pcre ssl vim-syntax"
for mod in $NGINX_MODULES_STD; do
IUSE="${IUSE} +nginx_modules_http_${mod}"
done
for mod in $NGINX_MODULES_OPT; do
IUSE="${IUSE} nginx_modules_http_${mod}"
done
for mod in $NGINX_MODULES_MAIL; do
IUSE="${IUSE} nginx_modules_mail_${mod}"
done
for mod in $NGINX_MODULES_3RD; do
IUSE="${IUSE} nginx_modules_${mod}"
done
CDEPEND="
pcre? ( >=dev-libs/libpcre-4.2 )
ssl? ( dev-libs/openssl )
http-cache? ( userland_GNU? ( dev-libs/openssl ) )
nginx_modules_http_geo? ( dev-libs/geoip )
nginx_modules_http_gzip? ( sys-libs/zlib )
nginx_modules_http_gzip_static? ( sys-libs/zlib )
nginx_modules_http_image_filter? ( media-libs/gd[jpeg,png] )
nginx_modules_http_perl? ( >=dev-lang/perl-5.8
dev-perl/FCGI
dev-perl/FCGI-ProcManager )
nginx_modules_http_rewrite? ( >=dev-libs/libpcre-4.2 )
nginx_modules_http_secure_link? ( userland_GNU? ( dev-libs/openssl ) )
nginx_modules_http_xslt? ( dev-libs/libxml2 dev-libs/libxslt )
nginx_modules_http_passenger? (
$(ruby_implementation_depend ruby18)
=www-apache/${HTTP_PASSENGER_MODULE_P}
>=dev-ruby/rubygems-0.9.0
>=dev-ruby/rake-0.8.1
>=dev-ruby/fastthread-1.0.1
>=dev-ruby/rack-1.0.0
)"
RDEPEND="${CDEPEND}"
DEPEND="${CDEPEND}
arm? ( dev-libs/libatomic_ops )
libatomic? ( dev-libs/libatomic_ops )"
PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
ALLWORKDIR="${WORKDIR}/all"
S="${ALLWORKDIR}/${P}"
pkg_setup() {
ebegin "Creating nginx user and group"
enewgroup ${PN}
enewuser ${PN} -1 -1 -1 ${PN}
eend $?
if use libatomic; then
ewarn "GCC 4.1+ features built-in atomic operations."
ewarn "Using libatomic_ops is only needed if using"
ewarn "a different compiler or a GCC prior to 4.1"
fi
if [[ -n $NGINX_ADD_MODULES ]]; then
ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
ewarn "This nginx installation is not supported!"
ewarn "Make sure you can reproduce the bug without those modules"
ewarn "_before_ reporting bugs."
fi
if use !http; then
ewarn "To actually disable all http-functionality you also have to disable"
ewarn "all nginx http modules."
fi
if use nginx_modules_http_passenger; then
ruby-ng_pkg_setup
use debug && append-flags -DPASSENGER_DEBUG
fi
}
src_prepare() {
sed -i 's/ make/ \\$(MAKE)/' "${S}"/auto/lib/perl/make
if use nginx_modules_http_passenger; then
cd "${ALLWORKDIR}/${HTTP_PASSENGER_MODULE_P}"
pwd
epatch "${FILESDIR}/passenger-CFLAGS-headers.patch"
fi
}
src_configure() {
local myconf= http_enabled= mail_enabled=
use aio && myconf+=" --with-file-aio --with-aio_module"
use debug && myconf+=" --with-debug"
use ipv6 && myconf+=" --with-ipv6"
use libatomic && myconf+=" --with-libatomic"
use pcre && myconf+=" --with-pcre"
# HTTP modules
for mod in $NGINX_MODULES_STD; do
if use nginx_modules_http_${mod}; then
http_enabled=1
else
myconf+=" --without-http_${mod}_module"
fi
done
for mod in $NGINX_MODULES_OPT; do
if use nginx_modules_http_${mod}; then
http_enabled=1
myconf+=" --with-http_${mod}_module"
fi
done
if use nginx_modules_http_fastcgi; then
myconf+=" --with-http_realip_module"
fi
# third-party modules
if use nginx_modules_http_upload_progress; then
http_enabled=1
myconf+=" --add-module=${ALLWORKDIR}/masterzen-nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_SHA1}"
fi
if use nginx_modules_http_headers_more; then
http_enabled=1
myconf+=" --add-module=${ALLWORKDIR}/agentzh-headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_SHA1}"
fi
if use nginx_modules_http_push; then
http_enabled=1
myconf+=" --add-module=${ALLWORKDIR}/${HTTP_PUSH_MODULE_P}"
fi
if use nginx_modules_http_cache_purge; then
http_enabled=1
myconf+=" --add-module=${ALLWORKDIR}/${HTTP_CACHE_PURGE_MODULE_P}"
fi
if use nginx_modules_http_upload; then
http_enabled=1
myconf+=" --add-module=${ALLWORKDIR}/${HTTP_UPLOAD_MODULE_P}"
fi
if use nginx_modules_http_slowfs_cache; then
http_enabled=1
myconf+=" --add-module=${ALLWORKDIR}/${HTTP_SLOWFS_CACHE_MODULE_P}"
fi
if use nginx_modules_http_passenger; then
http_enabled=1
myconf="${myconf} --add-module=${ALLWORKDIR}/${HTTP_PASSENGER_MODULE_P}/ext/nginx"
fi
if use http || use http-cache; then
http_enabled=1
fi
if [ $http_enabled ]; then
use http-cache || myconf+=" --without-http-cache"
use ssl && myconf+=" --with-http_ssl_module"
else
myconf+=" --without-http --without-http-cache"
fi
# MAIL modules
for mod in $NGINX_MODULES_MAIL; do
if use nginx_modules_mail_${mod}; then
mail_enabled=1
else
myconf+=" --without-mail_${mod}_module"
fi
done
if [ $mail_enabled ]; then
myconf+=" --with-mail"
use ssl && myconf+=" --with-mail_ssl_module"
fi
# custom modules
for mod in $NGINX_ADD_MODULES; do
myconf+=" --add-module=${mod}"
done
# https://bugs.gentoo.org/286772
export LANG=C LC_ALL=C
tc-export CC
./configure \
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/${PN}/${PN}.conf \
--error-log-path=/var/log/${PN}/error_log \
--pid-path=/var/run/${PN}.pid \
--lock-path=/var/lock/nginx.lock \
--user=${PN} --group=${PN} \
--with-cc-opt="-I${ROOT}usr/include" \
--with-ld-opt="-L${ROOT}usr/lib" \
--http-log-path=/var/log/${PN}/access_log \
--http-client-body-temp-path=/var/tmp/${PN}/client \
--http-proxy-temp-path=/var/tmp/${PN}/proxy \
--http-fastcgi-temp-path=/var/tmp/${PN}/fastcgi \
--http-scgi-temp-path=/var/tmp/${PN}/scgi \
--http-uwsgi-temp-path=/var/tmp/${PN}/uwsgi \
${myconf} || die "configure failed"
}
src_compile() {
# https://bugs.gentoo.org/286772
export LANG=C LC_ALL=C
emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}" || die "emake failed"
}
src_install() {
keepdir /var/log/${PN} /var/tmp/${PN}/{client,proxy,fastcgi,scgi,uwsgi}
keepdir /var/www/localhost/htdocs
dosbin objs/nginx
newinitd "${FILESDIR}"/nginx.init-r2 nginx
cp "${FILESDIR}"/nginx.conf-r4 conf/nginx.conf
rm conf/win-utf conf/koi-win conf/koi-utf
dodir /etc/${PN}
insinto /etc/${PN}
doins conf/*
doman man/nginx.8
dodoc CHANGES* README
# logrotate
insinto /etc/logrotate.d
newins "${FILESDIR}"/nginx.logrotate nginx
if use nginx_modules_http_perl; then
# perl wrapper
dobin "${FILESDIR}/cgiwrap-fcgi.pl"
newinitd "${FILESDIR}/cgiwrap-fcgi.init" cgiwrap-fcgi
cd "objs/src/http/modules/perl/"
einstall DESTDIR="${D}" INSTALLDIRS=vendor || die "failed to install perl stuff"
fixlocalpod
fi
if use nginx_modules_http_push; then
docinto ${HTTP_PUSH_MODULE_P}
dodoc "${ALLWORKDIR}"/${HTTP_PUSH_MODULE_P}/{changelog.txt,protocol.txt,README}
fi
if use nginx_modules_http_cache_purge; then
docinto ${HTTP_CACHE_PURGE_MODULE_P}
dodoc "${ALLWORKDIR}"/${HTTP_CACHE_PURGE_MODULE_P}/{CHANGES,README}
fi
if use nginx_modules_http_upload; then
docinto ${HTTP_UPLOAD_MODULE_P}
dodoc "${ALLWORKDIR}"/${HTTP_UPLOAD_MODULE_P}/{Changelog,README}
fi
if use nginx_modules_http_slowfs_cache; then
docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
dodoc "${ALLWORKDIR}"/${HTTP_SLOWFS_CACHE_MODULE_P}/{CHANGES,README}
fi
}
pkg_postinst() {
if use ssl; then
if [ ! -f "${ROOT}"/etc/ssl/${PN}/${PN}.key ]; then
install_cert /etc/ssl/${PN}/${PN}
chown ${PN}:${PN} "${ROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
fi
fi
}
Loading…
Cancel
Save