Add conditionals to assist in backporting nginx to non-systemd distros.
This commit is contained in:
parent
eed161fdbd
commit
6267fca680
11
nginx-1.4.2.tar.gz.asc
Normal file
11
nginx-1.4.2.tar.gz.asc
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
Version: GnuPG v1.4.13 (FreeBSD)
|
||||||
|
|
||||||
|
iQEcBAABAgAGBQJR5pgsAAoJEFIKmZOhwFL4EpAH/jwNVReYdC7UprxfrWQQCMGb
|
||||||
|
SnDJwLycynEtJuexviVl6w/bLkvVYRVrF9zxWEgaqymVjdp9f/AkJgwNlGsVaz4K
|
||||||
|
T11WuLGK1kZc6LvKZSZVsU6fbxYnkjbnpd2Uo47k+aLHfMMFZ5vtoEdxN5ANxu7A
|
||||||
|
8AP1r9+n9h5VOYt59IuyPmPn/Q7zPo/tK+snHv2UOupFutcjXe/44eKHpVM8iAnV
|
||||||
|
+O0so5wuAmbYVatA6/mu1HyWGrFId4qOH/RJeHb+OmGO6gU1QFB3SNe8EgKd4okl
|
||||||
|
3HepqhhRrJFxfN3mg7qoraHwMhT/ajUWUFcWtJuSEfVCSIPGVpAcTON8EqnplSA=
|
||||||
|
=HR/R
|
||||||
|
-----END PGP SIGNATURE-----
|
144
nginx.init
Normal file
144
nginx.init
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# nginx - this script starts and stops the nginx daemon
|
||||||
|
#
|
||||||
|
# chkconfig: - 85 15
|
||||||
|
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
|
||||||
|
# proxy and IMAP/POP3 proxy server
|
||||||
|
# processname: nginx
|
||||||
|
# config: /etc/nginx/nginx.conf
|
||||||
|
# config: /etc/sysconfig/nginx
|
||||||
|
# pidfile: /var/run/nginx.pid
|
||||||
|
|
||||||
|
# Source function library.
|
||||||
|
. /etc/rc.d/init.d/functions
|
||||||
|
|
||||||
|
# Source networking configuration.
|
||||||
|
. /etc/sysconfig/network
|
||||||
|
|
||||||
|
# Check that networking is up.
|
||||||
|
[ "$NETWORKING" = "no" ] && exit 0
|
||||||
|
|
||||||
|
nginx="/usr/sbin/nginx"
|
||||||
|
prog=$(basename $nginx)
|
||||||
|
|
||||||
|
sysconfig="/etc/sysconfig/$prog"
|
||||||
|
lockfile="/var/lock/subsys/nginx"
|
||||||
|
pidfile="/var/run/${prog}.pid"
|
||||||
|
|
||||||
|
NGINX_CONF_FILE="/etc/nginx/nginx.conf"
|
||||||
|
|
||||||
|
[ -f $sysconfig ] && . $sysconfig
|
||||||
|
|
||||||
|
|
||||||
|
start() {
|
||||||
|
[ -x $nginx ] || exit 5
|
||||||
|
[ -f $NGINX_CONF_FILE ] || exit 6
|
||||||
|
echo -n $"Starting $prog: "
|
||||||
|
daemon $nginx -c $NGINX_CONF_FILE
|
||||||
|
retval=$?
|
||||||
|
echo
|
||||||
|
[ $retval -eq 0 ] && touch $lockfile
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
echo -n $"Stopping $prog: "
|
||||||
|
killproc -p $pidfile $prog
|
||||||
|
retval=$?
|
||||||
|
echo
|
||||||
|
[ $retval -eq 0 ] && rm -f $lockfile
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
|
||||||
|
restart() {
|
||||||
|
configtest_q || return 6
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
configtest_q || return 6
|
||||||
|
echo -n $"Reloading $prog: "
|
||||||
|
killproc -p $pidfile $prog -HUP
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
configtest() {
|
||||||
|
$nginx -t -c $NGINX_CONF_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
configtest_q() {
|
||||||
|
$nginx -t -q -c $NGINX_CONF_FILE
|
||||||
|
}
|
||||||
|
|
||||||
|
rh_status() {
|
||||||
|
status $prog
|
||||||
|
}
|
||||||
|
|
||||||
|
rh_status_q() {
|
||||||
|
rh_status >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Upgrade the binary with no downtime.
|
||||||
|
upgrade() {
|
||||||
|
local oldbin_pidfile="${pidfile}.oldbin"
|
||||||
|
|
||||||
|
configtest_q || return 6
|
||||||
|
echo -n $"Upgrading $prog: "
|
||||||
|
killproc -p $pidfile $prog -USR2
|
||||||
|
retval=$?
|
||||||
|
sleep 1
|
||||||
|
if [[ -f ${oldbin_pidfile} && -f ${pidfile} ]]; then
|
||||||
|
killproc -p $oldbin_pidfile $prog -QUIT
|
||||||
|
success $"$prog online upgrade"
|
||||||
|
echo
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
failure $"$prog online upgrade"
|
||||||
|
echo
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tell nginx to reopen logs
|
||||||
|
reopen_logs() {
|
||||||
|
configtest_q || return 6
|
||||||
|
echo -n $"Reopening $prog logs: "
|
||||||
|
killproc -p $pidfile $prog -USR1
|
||||||
|
retval=$?
|
||||||
|
echo
|
||||||
|
return $retval
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
rh_status_q && exit 0
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
rh_status_q || exit 0
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
restart|configtest|reopen_logs)
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
force-reload|upgrade)
|
||||||
|
rh_status_q || exit 7
|
||||||
|
upgrade
|
||||||
|
;;
|
||||||
|
reload)
|
||||||
|
rh_status_q || exit 7
|
||||||
|
$1
|
||||||
|
;;
|
||||||
|
status|status_q)
|
||||||
|
rh_$1
|
||||||
|
;;
|
||||||
|
condrestart|try-restart)
|
||||||
|
rh_status_q || exit 7
|
||||||
|
restart
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage: $0 {start|stop|reload|configtest|status|force-reload|upgrade|restart|reopen_logs}"
|
||||||
|
exit 2
|
||||||
|
esac
|
56
nginx.spec
56
nginx.spec
@ -17,7 +17,7 @@
|
|||||||
Name: nginx
|
Name: nginx
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 1.4.2
|
Version: 1.4.2
|
||||||
Release: 2%{?dist}
|
Release: 3%{?dist}
|
||||||
|
|
||||||
Summary: A high performance web server and reverse proxy server
|
Summary: A high performance web server and reverse proxy server
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
@ -33,6 +33,8 @@ Source11: nginx.logrotate
|
|||||||
Source12: nginx.conf
|
Source12: nginx.conf
|
||||||
Source13: nginx-upgrade
|
Source13: nginx-upgrade
|
||||||
Source14: nginx-upgrade.8
|
Source14: nginx-upgrade.8
|
||||||
|
Source15: nginx.init
|
||||||
|
Source16: nginx.sysconfig
|
||||||
Source100: index.html
|
Source100: index.html
|
||||||
Source101: poweredby.png
|
Source101: poweredby.png
|
||||||
Source102: nginx-logo.png
|
Source102: nginx-logo.png
|
||||||
@ -54,17 +56,24 @@ BuildRequires: pcre-devel
|
|||||||
BuildRequires: perl-devel
|
BuildRequires: perl-devel
|
||||||
BuildRequires: perl(ExtUtils::Embed)
|
BuildRequires: perl(ExtUtils::Embed)
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
BuildRequires: systemd
|
|
||||||
Requires: GeoIP
|
Requires: GeoIP
|
||||||
Requires: gd
|
Requires: gd
|
||||||
Requires: openssl
|
Requires: openssl
|
||||||
Requires: pcre
|
Requires: pcre
|
||||||
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
||||||
Requires(pre): shadow-utils
|
Requires(pre): shadow-utils
|
||||||
|
Provides: webserver
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 16
|
||||||
|
BuildRequires: systemd
|
||||||
Requires(post): systemd
|
Requires(post): systemd
|
||||||
Requires(preun): systemd
|
Requires(preun): systemd
|
||||||
Requires(postun): systemd
|
Requires(postun): systemd
|
||||||
Provides: webserver
|
%else
|
||||||
|
Requires(post): chkconfig
|
||||||
|
Requires(preun): chkconfig, initscripts
|
||||||
|
Requires(postun): initscripts
|
||||||
|
%endif
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
|
Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and
|
||||||
@ -94,8 +103,13 @@ export DESTDIR=%{buildroot}
|
|||||||
--http-fastcgi-temp-path=%{nginx_home_tmp}/fastcgi \
|
--http-fastcgi-temp-path=%{nginx_home_tmp}/fastcgi \
|
||||||
--http-uwsgi-temp-path=%{nginx_home_tmp}/uwsgi \
|
--http-uwsgi-temp-path=%{nginx_home_tmp}/uwsgi \
|
||||||
--http-scgi-temp-path=%{nginx_home_tmp}/scgi \
|
--http-scgi-temp-path=%{nginx_home_tmp}/scgi \
|
||||||
|
%if 0%{?fedora} >= 16
|
||||||
--pid-path=/run/nginx.pid \
|
--pid-path=/run/nginx.pid \
|
||||||
--lock-path=/run/lock/subsys/nginx \
|
--lock-path=/run/lock/subsys/nginx \
|
||||||
|
%else
|
||||||
|
--pid-path=%{_localstatedir}/run/nginx.pid \
|
||||||
|
--lock-path=%{_localstatedir}/lock/subsys/nginx \
|
||||||
|
%endif
|
||||||
--user=%{nginx_user} \
|
--user=%{nginx_user} \
|
||||||
--group=%{nginx_group} \
|
--group=%{nginx_group} \
|
||||||
--with-file-aio \
|
--with-file-aio \
|
||||||
@ -138,9 +152,16 @@ find %{buildroot} -type f -name .packlist -exec rm -f '{}' \;
|
|||||||
find %{buildroot} -type f -name perllocal.pod -exec rm -f '{}' \;
|
find %{buildroot} -type f -name perllocal.pod -exec rm -f '{}' \;
|
||||||
find %{buildroot} -type f -empty -exec rm -f '{}' \;
|
find %{buildroot} -type f -empty -exec rm -f '{}' \;
|
||||||
find %{buildroot} -type f -iname '*.so' -exec chmod 0755 '{}' \;
|
find %{buildroot} -type f -iname '*.so' -exec chmod 0755 '{}' \;
|
||||||
|
%if 0%{?fedora} >= 16
|
||||||
install -p -D -m 0644 %{SOURCE10} \
|
install -p -D -m 0644 %{SOURCE10} \
|
||||||
%{buildroot}%{_unitdir}/nginx.service
|
%{buildroot}%{_unitdir}/nginx.service
|
||||||
|
%else
|
||||||
|
install -p -D -m 0755 %{SOURCE15} \
|
||||||
|
%{buildroot}%{_initrddir}/nginx
|
||||||
|
install -p -D -m 0644 %{SOURCE16} \
|
||||||
|
%{buildroot}%{_sysconfdir}/sysconfig/nginx
|
||||||
|
%endif
|
||||||
|
|
||||||
install -p -D -m 0644 %{SOURCE11} \
|
install -p -D -m 0644 %{SOURCE11} \
|
||||||
%{buildroot}%{_sysconfdir}/logrotate.d/nginx
|
%{buildroot}%{_sysconfdir}/logrotate.d/nginx
|
||||||
|
|
||||||
@ -174,7 +195,13 @@ getent passwd %{nginx_user} > /dev/null || \
|
|||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
%post
|
%post
|
||||||
|
%if 0%{?fedora} >= 16
|
||||||
%systemd_post nginx.service
|
%systemd_post nginx.service
|
||||||
|
%else
|
||||||
|
if [ $1 -eq 1 ]; then
|
||||||
|
/sbin/chkconfig --add %{name}
|
||||||
|
fi
|
||||||
|
%endif
|
||||||
if [ $1 -eq 2 ]; then
|
if [ $1 -eq 2 ]; then
|
||||||
# Make sure these directories are not world readable.
|
# Make sure these directories are not world readable.
|
||||||
chmod 700 %{nginx_home}
|
chmod 700 %{nginx_home}
|
||||||
@ -183,10 +210,23 @@ if [ $1 -eq 2 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
|
%if 0%{?fedora} >= 16
|
||||||
%systemd_preun nginx.service
|
%systemd_preun nginx.service
|
||||||
|
%else
|
||||||
|
if [ $1 -eq 0 ]; then
|
||||||
|
/sbin/service %{name} stop >/dev/null 2>&1
|
||||||
|
/sbin/chkconfig --del %{name}
|
||||||
|
fi
|
||||||
|
%endif
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
|
%if 0%{?fedora} >= 16
|
||||||
%systemd_postun nginx.service
|
%systemd_postun nginx.service
|
||||||
|
%else
|
||||||
|
if [ $1 -eq 2 ]; then
|
||||||
|
/sbin/service %{name} upgrade || :
|
||||||
|
fi
|
||||||
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc LICENSE CHANGES README
|
%doc LICENSE CHANGES README
|
||||||
@ -196,7 +236,12 @@ fi
|
|||||||
%{_mandir}/man3/nginx.3pm*
|
%{_mandir}/man3/nginx.3pm*
|
||||||
%{_mandir}/man8/nginx.8*
|
%{_mandir}/man8/nginx.8*
|
||||||
%{_mandir}/man8/nginx-upgrade.8*
|
%{_mandir}/man8/nginx-upgrade.8*
|
||||||
|
%if 0%{?fedora} >= 16
|
||||||
%{_unitdir}/nginx.service
|
%{_unitdir}/nginx.service
|
||||||
|
%else
|
||||||
|
%{_initrddir}/nginx
|
||||||
|
%config(noreplace) %{_sysconfdir}/sysconfig/nginx
|
||||||
|
%endif
|
||||||
%dir %{nginx_confdir}
|
%dir %{nginx_confdir}
|
||||||
%dir %{nginx_confdir}/conf.d
|
%dir %{nginx_confdir}/conf.d
|
||||||
%config(noreplace) %{nginx_confdir}/fastcgi.conf
|
%config(noreplace) %{nginx_confdir}/fastcgi.conf
|
||||||
@ -224,6 +269,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Aug 09 2013 Jonathan Steffan <jsteffan@fedoraproject.org> - 1:1.4.2-3
|
||||||
|
- Add in conditionals to build for non-systemd targets
|
||||||
|
|
||||||
* Sat Aug 03 2013 Petr Pisar <ppisar@redhat.com> - 1:1.4.2-2
|
* Sat Aug 03 2013 Petr Pisar <ppisar@redhat.com> - 1:1.4.2-2
|
||||||
- Perl 5.18 rebuild
|
- Perl 5.18 rebuild
|
||||||
|
|
||||||
|
4
nginx.sysconfig
Normal file
4
nginx.sysconfig
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Configuration file for the nginx service
|
||||||
|
|
||||||
|
# set this to the location of the nginx configuration file
|
||||||
|
NGINX_CONF_FILE=/etc/nginx/nginx.conf
|
Loading…
Reference in New Issue
Block a user