rpm: dropped support for sysvinit. The last OS that used sysvinit targets was RHEL 6, EOLed on 2020-11-30.
diff --git a/rpm/SOURCES/nginx-debug.sysconf b/rpm/SOURCES/nginx-debug.sysconf deleted file mode 100644 index f79b453..0000000 --- a/rpm/SOURCES/nginx-debug.sysconf +++ /dev/null
@@ -1,5 +0,0 @@ -# Configuration file for the nginx-debug service. - -NGINX=/usr/sbin/nginx-debug -CONFFILE=/etc/nginx/nginx.conf -LOCKFILE=/var/lock/subsys/nginx-debug
diff --git a/rpm/SOURCES/nginx.init.in b/rpm/SOURCES/nginx.init.in deleted file mode 100755 index 4370c67..0000000 --- a/rpm/SOURCES/nginx.init.in +++ /dev/null
@@ -1,169 +0,0 @@ -#!/bin/sh -# -# nginx Startup script for nginx -# -# chkconfig: - 85 15 -# processname: %PROVIDES% -# config: /etc/nginx/nginx.conf -# config: /etc/sysconfig/%PROVIDES% -# pidfile: /var/run/nginx.pid -# description: nginx is an HTTP and reverse proxy server -# -### BEGIN INIT INFO -# Provides: %PROVIDES% -# Required-Start: $local_fs $remote_fs $network -# Required-Stop: $local_fs $remote_fs $network -# Default-Start: %DEFAULTSTART% -# Default-Stop: %DEFAULTSTOP% -# Short-Description: start and stop nginx -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -if [ -L $0 ]; then - initscript=`/bin/readlink -f $0` -else - initscript=$0 -fi - -sysconfig=`/bin/basename $initscript` - -if [ -f /etc/sysconfig/$sysconfig ]; then - . /etc/sysconfig/$sysconfig -fi - -nginx=${NGINX:-/usr/sbin/%PROVIDES%} -prog=`/bin/basename $nginx` -conffile=${CONFFILE:-/etc/nginx/nginx.conf} -lockfile=${LOCKFILE:-/var/lock/subsys/%PROVIDES%} -pidfile=${PIDFILE:-/var/run/nginx.pid} -SLEEPSEC=${SLEEPSEC:-1} -UPGRADEWAITLOOPS=${UPGRADEWAITLOOPS:-5} -CHECKSLEEP=${CHECKSLEEP:-3} -RETVAL=0 - -start() { - echo -n $"Starting $prog: " - - daemon --pidfile=${pidfile} ${nginx} -c ${conffile} - RETVAL=$? - echo - [ $RETVAL = 0 ] && touch ${lockfile} - return $RETVAL -} - -stop() { - echo -n $"Stopping $prog: " - killproc -p ${pidfile} ${prog} - RETVAL=$? - echo - [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} -} - -reload() { - echo -n $"Reloading $prog: " - killproc -p ${pidfile} ${prog} -HUP - RETVAL=$? - echo -} - -upgrade() { - oldbinpidfile=${pidfile}.oldbin - - configtest -q || return - echo -n $"Starting new master $prog: " - killproc -p ${pidfile} ${prog} -USR2 - echo - - for i in `/usr/bin/seq $UPGRADEWAITLOOPS`; do - /bin/sleep $SLEEPSEC - if [ -f ${oldbinpidfile} -a -f ${pidfile} ]; then - echo -n $"Graceful shutdown of old $prog: " - killproc -p ${oldbinpidfile} ${prog} -QUIT - RETVAL=$? - echo - return - fi - done - - echo $"Upgrade failed!" - RETVAL=1 -} - -configtest() { - if [ "$#" -ne 0 ] ; then - case "$1" in - -q) - FLAG=$1 - ;; - *) - ;; - esac - shift - fi - ${nginx} -t -c ${conffile} $FLAG - RETVAL=$? - return $RETVAL -} - -rh_status() { - status -p ${pidfile} -b ${nginx} ${nginx} -} - -check_reload() { - templog=`/bin/mktemp --tmpdir nginx-check-reload-XXXXXX.log` - trap '/bin/rm -f $templog' 0 - /usr/bin/tail --pid=$$ -n 0 --follow=name /var/log/nginx/error.log > $templog & - /bin/sleep 1 - /bin/echo -n $"Sending reload signal to $prog: " - killproc -p ${pidfile} ${prog} -HUP - /bin/echo - /bin/sleep $CHECKSLEEP - /bin/grep -E "\[emerg\]|\[alert\]" $templog -} - -# See how we were called. -case "$1" in - start) - rh_status >/dev/null 2>&1 && exit 0 - start - ;; - stop) - stop - ;; - status) - rh_status - RETVAL=$? - ;; - restart) - configtest -q || exit $RETVAL - stop - start - ;; - upgrade) - rh_status >/dev/null 2>&1 || exit 0 - upgrade - ;; - condrestart|try-restart) - if rh_status >/dev/null 2>&1; then - stop - start - fi - ;; - force-reload|reload) - reload - ;; - configtest) - configtest - ;; - check-reload) - check_reload - RETVAL=0 - ;; - *) - echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|upgrade|reload|status|help|configtest|check-reload}" - RETVAL=2 -esac - -exit $RETVAL
diff --git a/rpm/SOURCES/nginx.sysconf b/rpm/SOURCES/nginx.sysconf deleted file mode 100644 index 6c31a48..0000000 --- a/rpm/SOURCES/nginx.sysconf +++ /dev/null
@@ -1,4 +0,0 @@ -# Configuration file for the nginx service. - -NGINX=/usr/sbin/nginx -CONFFILE=/etc/nginx/nginx.conf
diff --git a/rpm/SPECS/nginx.spec.in b/rpm/SPECS/nginx.spec.in index 8791c57..415eabb 100644 --- a/rpm/SPECS/nginx.spec.in +++ b/rpm/SPECS/nginx.spec.in
@@ -4,28 +4,15 @@ %define nginx_group nginx %define nginx_loggroup adm -# distribution specific definitions -%define use_systemd (0%{?rhel} >= 7 || 0%{?fedora} >= 19 || 0%{?suse_version} >= 1315 || 0%{?amzn} >= 2) - -%if %{use_systemd} BuildRequires: systemd Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -%endif %if 0%{?rhel} %define _group System Environment/Daemons %endif -%if 0%{?rhel} == 6 -Requires(pre): shadow-utils -Requires: initscripts >= 8.36 -Requires(post): chkconfig -Requires: openssl >= 1.0.1 -BuildRequires: openssl-devel >= 1.0.1 -%endif - %if 0%{?rhel} == 7 %define epoch 1 Epoch: %{epoch} @@ -81,11 +68,8 @@ Source0: https://nginx.org/download/%{name}-%{version}.tar.gz Source1: logrotate -Source2: nginx.init.in -Source3: nginx.sysconf Source4: nginx.conf Source5: nginx.default.conf -Source7: nginx-debug.sysconf Source8: nginx.service Source9: nginx.upgrade.sh Source10: nginx.suse.logrotate @@ -114,11 +98,6 @@ %prep %autosetup -p1 -cp %{SOURCE2} . -sed -e 's|%%DEFAULTSTART%%|2 3 4 5|g' -e 's|%%DEFAULTSTOP%%|0 1 6|g' \ - -e 's|%%PROVIDES%%|nginx|g' < %{SOURCE2} > nginx.init -sed -e 's|%%DEFAULTSTART%%||g' -e 's|%%DEFAULTSTOP%%|0 1 2 3 4 5 6|g' \ - -e 's|%%PROVIDES%%|nginx-debug|g' < %{SOURCE2} > nginx-debug.init %build ./configure %{BASE_CONFIGURE_ARGS} \ @@ -162,17 +141,9 @@ %{__install} -m 644 -p %{SOURCE5} \ $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/default.conf -%{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig -%{__install} -m 644 -p %{SOURCE3} \ - $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx -%{__install} -m 644 -p %{SOURCE7} \ - $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nginx-debug - %{__install} -p -D -m 0644 %{bdir}/objs/nginx.8 \ $RPM_BUILD_ROOT%{_mandir}/man8/nginx.8 -%if %{use_systemd} -# install systemd-specific files %{__mkdir} -p $RPM_BUILD_ROOT%{_unitdir} %{__install} -m644 %SOURCE8 \ $RPM_BUILD_ROOT%{_unitdir}/nginx.service @@ -183,12 +154,6 @@ $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/upgrade %{__install} -m755 %SOURCE13 \ $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/nginx/check-reload -%else -# install SYSV init stuff -%{__mkdir} -p $RPM_BUILD_ROOT%{_initrddir} -%{__install} -m755 nginx.init $RPM_BUILD_ROOT%{_initrddir}/nginx -%{__install} -m755 nginx-debug.init $RPM_BUILD_ROOT%{_initrddir}/nginx-debug -%endif # install log rotation stuff %{__mkdir} -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d @@ -236,17 +201,10 @@ %config(noreplace) %{_sysconfdir}/nginx/win-utf %config(noreplace) %{_sysconfdir}/logrotate.d/nginx -%config(noreplace) %{_sysconfdir}/sysconfig/nginx -%config(noreplace) %{_sysconfdir}/sysconfig/nginx-debug -%if %{use_systemd} %{_unitdir}/nginx.service %{_unitdir}/nginx-debug.service %dir %{_libexecdir}/initscripts/legacy-actions/nginx %{_libexecdir}/initscripts/legacy-actions/nginx/* -%else -%{_initrddir}/nginx -%{_initrddir}/nginx-debug -%endif %attr(0755,root,root) %dir %{_libdir}/nginx %attr(0755,root,root) %dir %{_libdir}/nginx/modules @@ -272,13 +230,8 @@ %post # Register the nginx service if [ $1 -eq 1 ]; then -%if %{use_systemd} /usr/bin/systemctl preset nginx.service >/dev/null 2>&1 ||: /usr/bin/systemctl preset nginx-debug.service >/dev/null 2>&1 ||: -%else - /sbin/chkconfig --add nginx - /sbin/chkconfig --add nginx-debug -%endif # print site info cat <<BANNER ---------------------------------------------------------------------- @@ -317,20 +270,12 @@ %preun if [ $1 -eq 0 ]; then -%if %use_systemd /usr/bin/systemctl --no-reload disable nginx.service >/dev/null 2>&1 ||: /usr/bin/systemctl stop nginx.service >/dev/null 2>&1 ||: -%else - /sbin/service nginx stop > /dev/null 2>&1 - /sbin/chkconfig --del nginx - /sbin/chkconfig --del nginx-debug -%endif fi %postun -%if %use_systemd /usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||: -%endif if [ $1 -ge 1 ]; then /sbin/service nginx status >/dev/null 2>&1 || exit 0 /sbin/service nginx upgrade >/dev/null 2>&1 || echo \