Packages: dropped support for non-systemd distributions.

This commit is contained in:
Konstantin Pavlov
2020-11-24 13:25:09 +03:00
parent c33b10a41f
commit 9c09bc1772
5 changed files with 9 additions and 214 deletions

View File

@@ -96,7 +96,7 @@ install: build do.tests
dh_testroot dh_testroot
dh_prep dh_prep
dh_installdirs dh_installdirs
dh_installinit dh_installsystemd
dh_installlogrotate dh_installlogrotate
cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR) make install cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR) make install
cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR_dev) make libunit-install cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR_dev) make libunit-install

View File

@@ -1,74 +0,0 @@
#!/bin/sh
#
# unitd NGINX Unit
#
### BEGIN INIT INFO
# Provides: unitd
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: NGINX Unit
# Description: NGINX Unit
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/unitd
NAME=unit
DESC=unitd
#includes lsb functions
. /lib/lsb/init-functions
test -f $DAEMON || exit 0
umask 022
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- $DAEMON_ARGS; then
log_end_msg 0
else
log_end_msg 1
fi
;;
status)
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON; then
log_end_msg 0
else
log_end_msg 1
fi
;;
reload|force-reload)
echo "Not implemented." >&2
exit 1
;;
restart)
log_action_begin_msg "Restarting $DESC" "$NAME"
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON || true
sleep 1
if start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_ARGS; then
log_end_msg 0
else
log_end_msg 1
fi
;;
*)
echo "Usage: /etc/init.d/$NAME {start|status|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@@ -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 $?

View File

@@ -1 +0,0 @@
UNITD_OPTIONS="--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid"

View File

@@ -1,19 +1,7 @@
# distribution specific definitions # distribution specific definitions
%define use_systemd (0%{?rhel} >= 7 || 0%{?fedora} >= 19 || 0%{?suse_version} >= 1315)
%define bdir %{_builddir}/%{name}-%{version} %define bdir %{_builddir}/%{name}-%{version}
%define dotests 0 %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} %if 0%{?rhel}%{?fedora}
BuildRequires: gcc BuildRequires: gcc
BuildRequires: openssl-devel BuildRequires: openssl-devel
@@ -48,12 +36,14 @@ Group: System Environment/Daemons
Source0: unit-%{version}.tar.gz Source0: unit-%{version}.tar.gz
Source1: unit.service Source1: unit.service
Source2: unit.init Source2: unit.example.config
Source3: unit.sysconf Source3: unit.logrotate
Source4: unit.example.config
Source5: unit.logrotate
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description %description
NGINX Unit is a runtime and delivery environment for modern distributed 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}%{_sharedstatedir}/unit
%{__mkdir} -p %{buildroot}%{_localstatedir}/log/unit %{__mkdir} -p %{buildroot}%{_localstatedir}/log/unit
%{__mkdir} -p %{buildroot}%{_localstatedir}/run/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 %{__mkdir} -p %{buildroot}%{_sysconfdir}/logrotate.d
%{__install} -m 644 -p %{SOURCE5} \ %{__install} -m 644 -p %{SOURCE3} \
%{buildroot}%{_sysconfdir}/logrotate.d/unit %{buildroot}%{_sysconfdir}/logrotate.d/unit
%{__mkdir} -p %{buildroot}%{_sysconfdir}/unit %{__mkdir} -p %{buildroot}%{_sysconfdir}/unit
%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit/examples %{__mkdir} -p %{buildroot}%{_datadir}/doc/unit/examples
%{__install} -m 644 -p %{SOURCE4} \ %{__install} -m 644 -p %{SOURCE2} \
%{buildroot}%{_datadir}/doc/unit/examples/example.config %{buildroot}%{_datadir}/doc/unit/examples/example.config
%{__install} -m 644 -p CHANGES \ %{__install} -m 644 -p CHANGES \
%{buildroot}%{_datadir}/doc/unit/ %{buildroot}%{_datadir}/doc/unit/
@@ -135,14 +120,8 @@ DESTDIR=%{buildroot} make unitd-install libunit-install
%{__install} -m 644 -p README \ %{__install} -m 644 -p README \
%{buildroot}%{_datadir}/doc/unit/ %{buildroot}%{_datadir}/doc/unit/
# init scripts
%if %{use_systemd}
%{__rm} -rf %{buildroot}%{_initrddir}/ %{__rm} -rf %{buildroot}%{_initrddir}/
%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/unit.service %{__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 QA_SKIP_BUILD_ROOT=1
export QA_SKIP_BUILD_ROOT export QA_SKIP_BUILD_ROOT
@@ -164,11 +143,7 @@ cat /dev/null > debugsourcefiles.list
%post %post
if [ $1 -eq 1 ]; then if [ $1 -eq 1 ]; then
%if %{use_systemd}
/usr/bin/systemctl preset unit.service >/dev/null 2>&1 ||: /usr/bin/systemctl preset unit.service >/dev/null 2>&1 ||:
%else
/sbin/chkconfig --add unit
%endif
cat <<BANNER cat <<BANNER
---------------------------------------------------------------------- ----------------------------------------------------------------------
@@ -185,25 +160,14 @@ fi
%preun %preun
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
%if %{use_systemd}
/usr/bin/systemctl --no-reload disable unit.service >/dev/null 2>&1 ||: /usr/bin/systemctl --no-reload disable unit.service >/dev/null 2>&1 ||:
/usr/bin/systemctl stop 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 fi
%postun %postun
%if %{use_systemd}
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||: /usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||:
%endif
if [ $1 -ge 1 ]; then if [ $1 -ge 1 ]; then
%if %{use_systemd}
/usr/bin/systemctl try-restart unit.service >/dev/null 2>&1 ||: /usr/bin/systemctl try-restart unit.service >/dev/null 2>&1 ||:
%else
/sbin/service unit condrestart >/dev/null 2>&1 ||:
%endif
fi fi
%files %files
@@ -211,14 +175,8 @@ fi
%attr(0755,root,root) %{_sbindir}/unitd %attr(0755,root,root) %{_sbindir}/unitd
%attr(0755,root,root) %{_sbindir}/unitd-debug %attr(0755,root,root) %{_sbindir}/unitd-debug
%dir %{_sysconfdir}/unit %dir %{_sysconfdir}/unit
%if %{use_systemd}
%{_unitdir}/unit.service %{_unitdir}/unit.service
%dir %attr(0755,root,root) %ghost %{_localstatedir}/run/unit %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 %dir %{_datadir}/doc/unit
%{_datadir}/doc/unit/* %{_datadir}/doc/unit/*
%dir %{_libdir}/unit/modules %dir %{_libdir}/unit/modules