summaryrefslogtreecommitdiffhomepage
path: root/pkg/rpm
diff options
context:
space:
mode:
authorKonstantin Pavlov <thresh@nginx.com>2020-11-24 13:25:09 +0300
committerKonstantin Pavlov <thresh@nginx.com>2020-11-24 13:25:09 +0300
commit9c09bc17726ccb2ab769faec6aacbe38db1b2e0f (patch)
tree6537af1a427736956f97afa11f78580b306427bf /pkg/rpm
parentc33b10a41fc76353295bee72a53a75e96441cc49 (diff)
downloadunit-9c09bc17726ccb2ab769faec6aacbe38db1b2e0f.tar.gz
unit-9c09bc17726ccb2ab769faec6aacbe38db1b2e0f.tar.bz2
Packages: dropped support for non-systemd distributions.
Diffstat (limited to 'pkg/rpm')
-rw-r--r--pkg/rpm/rpmbuild/SOURCES/unit.init88
-rw-r--r--pkg/rpm/rpmbuild/SOURCES/unit.sysconf1
-rw-r--r--pkg/rpm/unit.spec.in58
3 files changed, 8 insertions, 139 deletions
diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.init b/pkg/rpm/rpmbuild/SOURCES/unit.init
deleted file mode 100644
index e1aacd81..00000000
--- a/pkg/rpm/rpmbuild/SOURCES/unit.init
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/bin/sh
-#
-# unitd NGINX Unit
-#
-# chkconfig: - 86 14
-# description: NGINX Unit
-
-### BEGIN INIT INFO
-# Provides: unitd
-# Required-Start: $local_fs $network $named $syslog
-# Required-Stop: $local_fs $network $named $syslog
-# Default-Start:
-# Default-Stop: 0 1 2 3 4 5 6
-# Short-Description: NGINX Unit
-# Description: NGINX Unit
-### END INIT INFO
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
-exec="/usr/sbin/unitd"
-prog="unitd"
-
-[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
-
-lockfile=/var/lock/subsys/$prog
-
-start() {
- [ -x $exec ] || exit 5
- echo -n $"Starting $prog: "
- daemon $exec $UNITD_OPTIONS
- retval=$?
- echo
- [ $retval -eq 0 ] && touch $lockfile
- return $retval
-}
-
-stop() {
- echo -n $"Stopping $prog: "
- killproc $prog
- retval=$?
- echo
- [ $retval -eq 0 ] && rm -f $lockfile
- return $retval
-}
-
-restart() {
- stop
- start
-}
-
-rh_status() {
- status $prog
-}
-
-rh_status_q() {
- rh_status &>/dev/null
-}
-
-
-case "$1" in
- start)
- rh_status_q && exit 0
- $1
- ;;
- stop)
- rh_status_q || exit 0
- $1
- ;;
- restart)
- $1
- ;;
- reload|force-reload)
- echo "Not implemented." >&2
- exit 1
- ;;
- status)
- rh_status
- ;;
- condrestart|try-restart)
- rh_status_q || exit 0
- restart
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
- exit 2
-esac
-exit $?
diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.sysconf b/pkg/rpm/rpmbuild/SOURCES/unit.sysconf
deleted file mode 100644
index 9146bdac..00000000
--- a/pkg/rpm/rpmbuild/SOURCES/unit.sysconf
+++ /dev/null
@@ -1 +0,0 @@
-UNITD_OPTIONS="--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid"
diff --git a/pkg/rpm/unit.spec.in b/pkg/rpm/unit.spec.in
index 7fc950ec..f2a77b61 100644
--- a/pkg/rpm/unit.spec.in
+++ b/pkg/rpm/unit.spec.in
@@ -1,19 +1,7 @@
# distribution specific definitions
-%define use_systemd (0%{?rhel} >= 7 || 0%{?fedora} >= 19 || 0%{?suse_version} >= 1315)
%define bdir %{_builddir}/%{name}-%{version}
%define dotests 0
-%if ( 0%{?rhel} == 5 || 0%{?rhel} == 6 )
-Requires: initscripts >= 8.36
-%endif
-
-%if %{use_systemd}
-BuildRequires: systemd
-Requires(post): systemd
-Requires(preun): systemd
-Requires(postun): systemd
-%endif
-
%if 0%{?rhel}%{?fedora}
BuildRequires: gcc
BuildRequires: openssl-devel
@@ -48,12 +36,14 @@ Group: System Environment/Daemons
Source0: unit-%{version}.tar.gz
Source1: unit.service
-Source2: unit.init
-Source3: unit.sysconf
-Source4: unit.example.config
-Source5: unit.logrotate
+Source2: unit.example.config
+Source3: unit.logrotate
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: systemd
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
%description
NGINX Unit is a runtime and delivery environment for modern distributed
@@ -116,17 +106,12 @@ DESTDIR=%{buildroot} make unitd-install libunit-install
%{__mkdir} -p %{buildroot}%{_sharedstatedir}/unit
%{__mkdir} -p %{buildroot}%{_localstatedir}/log/unit
%{__mkdir} -p %{buildroot}%{_localstatedir}/run/unit
-%if ! %{use_systemd}
-%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
-%{__install} -m 644 -p %{SOURCE3} \
- %{buildroot}%{_sysconfdir}/sysconfig/unitd
-%endif
%{__mkdir} -p %{buildroot}%{_sysconfdir}/logrotate.d
-%{__install} -m 644 -p %{SOURCE5} \
+%{__install} -m 644 -p %{SOURCE3} \
%{buildroot}%{_sysconfdir}/logrotate.d/unit
%{__mkdir} -p %{buildroot}%{_sysconfdir}/unit
%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit/examples
-%{__install} -m 644 -p %{SOURCE4} \
+%{__install} -m 644 -p %{SOURCE2} \
%{buildroot}%{_datadir}/doc/unit/examples/example.config
%{__install} -m 644 -p CHANGES \
%{buildroot}%{_datadir}/doc/unit/
@@ -135,14 +120,8 @@ DESTDIR=%{buildroot} make unitd-install libunit-install
%{__install} -m 644 -p README \
%{buildroot}%{_datadir}/doc/unit/
-# init scripts
-%if %{use_systemd}
%{__rm} -rf %{buildroot}%{_initrddir}/
%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/unit.service
-%else
-%{__mkdir} -p %{buildroot}%{_initrddir}
-%{__install} -p -D -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}/unit
-%endif
QA_SKIP_BUILD_ROOT=1
export QA_SKIP_BUILD_ROOT
@@ -164,11 +143,7 @@ cat /dev/null > debugsourcefiles.list
%post
if [ $1 -eq 1 ]; then
-%if %{use_systemd}
/usr/bin/systemctl preset unit.service >/dev/null 2>&1 ||:
-%else
- /sbin/chkconfig --add unit
-%endif
cat <<BANNER
----------------------------------------------------------------------
@@ -185,25 +160,14 @@ fi
%preun
if [ $1 -eq 0 ]; then
-%if %{use_systemd}
/usr/bin/systemctl --no-reload disable unit.service >/dev/null 2>&1 ||:
/usr/bin/systemctl stop unit.service >/dev/null 2>&1 ||:
-%else
- /sbin/service unit stop >/dev/null 2>&1
- /sbin/chkconfig --del unit
-%endif
fi
%postun
-%if %{use_systemd}
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||:
-%endif
if [ $1 -ge 1 ]; then
-%if %{use_systemd}
/usr/bin/systemctl try-restart unit.service >/dev/null 2>&1 ||:
-%else
- /sbin/service unit condrestart >/dev/null 2>&1 ||:
-%endif
fi
%files
@@ -211,14 +175,8 @@ fi
%attr(0755,root,root) %{_sbindir}/unitd
%attr(0755,root,root) %{_sbindir}/unitd-debug
%dir %{_sysconfdir}/unit
-%if %{use_systemd}
%{_unitdir}/unit.service
%dir %attr(0755,root,root) %ghost %{_localstatedir}/run/unit
-%else
-%config(noreplace) %{_sysconfdir}/sysconfig/unitd
-%dir %attr(0755,root,root) %{_localstatedir}/run/unit
-%{_initrddir}/unit
-%endif
%dir %{_datadir}/doc/unit
%{_datadir}/doc/unit/*
%dir %{_libdir}/unit/modules