Packages: systemd and other improvements.
See the following links for details: https://github.com/nginx/unit/pull/212 https://github.com/nginx/unit/issues/213 Closes #155, closes #212, closes #213.
This commit is contained in:
@@ -102,7 +102,7 @@ endif
|
|||||||
CONFIGURE_ARGS=\
|
CONFIGURE_ARGS=\
|
||||||
--prefix=/usr \
|
--prefix=/usr \
|
||||||
--state=%{_sharedstatedir}/unit \
|
--state=%{_sharedstatedir}/unit \
|
||||||
--control="unix:/var/run/control.unit.sock" \
|
--control="unix:/var/run/unit/control.sock" \
|
||||||
--pid=/var/run/unit.pid \
|
--pid=/var/run/unit.pid \
|
||||||
--log=/var/log/unit.log \
|
--log=/var/log/unit.log \
|
||||||
--tests \
|
--tests \
|
||||||
|
|||||||
10
pkg/rpm/rpmbuild/SOURCES/unit.logrotate
Normal file
10
pkg/rpm/rpmbuild/SOURCES/unit.logrotate
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/var/log/unit/*.log {
|
||||||
|
missingok
|
||||||
|
nocreate
|
||||||
|
notifempty
|
||||||
|
postrotate
|
||||||
|
if [ -f /var/run/unit/unit.pid ]; then
|
||||||
|
/bin/kill -SIGUSR1 `cat /var/run/unit/unit.pid`
|
||||||
|
fi
|
||||||
|
endscript
|
||||||
|
}
|
||||||
@@ -1,14 +1,26 @@
|
|||||||
|
# Modifying this file in-place is not recommended, because changes
|
||||||
|
# will be overwritten during package upgrades. To customize the
|
||||||
|
# behaviour, run "systemctl edit unit" to create an override unit.
|
||||||
|
|
||||||
|
# For example, to change options given to the unitd binary at startup,
|
||||||
|
# create an override unit (as is done by systemctl edit) and enter
|
||||||
|
# the following:
|
||||||
|
|
||||||
|
# [Service]
|
||||||
|
# Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /run/unit/unit.pid"
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=NGINX Unit
|
Description=NGINX Unit
|
||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=simple
|
||||||
PIDFile=/run/unit.pid
|
Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /run/unit/unit.pid"
|
||||||
EnvironmentFile=-/etc/sysconfig/unit
|
ExecStart=/usr/sbin/unitd $UNITD_OPTIONS --no-daemon
|
||||||
ExecStart=/usr/sbin/unitd $UNITD_OPTIONS
|
|
||||||
ExecReload=
|
ExecReload=
|
||||||
|
RuntimeDirectory=unit
|
||||||
|
RuntimeDirectoryMode=0755
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
UNITD_OPTIONS="--log /var/log/unit.log --pid /run/unit.pid"
|
UNITD_OPTIONS="--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid"
|
||||||
|
|||||||
@@ -1,25 +1,31 @@
|
|||||||
# distribution specific definitions
|
# distribution specific definitions
|
||||||
%define use_systemd (0%{?rhel} && 0%{?rhel} >= 7) || (0%{?suse_version} >= 1315)
|
%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 )
|
%if ( 0%{?rhel} == 5 || 0%{?rhel} == 6 )
|
||||||
Requires: initscripts >= 8.36
|
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
|
BuildRequires: openssl-devel
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?rhel} == 7
|
%if 0%{?rhel}
|
||||||
Requires: systemd
|
|
||||||
BuildRequires: systemd-units
|
|
||||||
BuildRequires: openssl-devel
|
|
||||||
%if 0%{?amzn} == 0
|
%if 0%{?amzn} == 0
|
||||||
%define dist .el7
|
%define dist .el%{?rhel}
|
||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?suse_version} >= 1315
|
%if 0%{?suse_version} >= 1315
|
||||||
BuildRequires: systemd
|
|
||||||
Requires: systemd
|
|
||||||
BuildRequires: libopenssl-devel
|
BuildRequires: libopenssl-devel
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@@ -45,6 +51,7 @@ Source1: unit.service
|
|||||||
Source2: unit.init
|
Source2: unit.init
|
||||||
Source3: unit.sysconf
|
Source3: unit.sysconf
|
||||||
Source4: unit.example.config
|
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)
|
||||||
|
|
||||||
@@ -103,9 +110,16 @@ DESTDIR=%{buildroot} make unitd-install libunit-install
|
|||||||
%{__mkdir} -p %{buildroot}%{_libdir}/unit/modules
|
%{__mkdir} -p %{buildroot}%{_libdir}/unit/modules
|
||||||
%{__mkdir} -p %{buildroot}%{_libdir}/unit/debug-modules
|
%{__mkdir} -p %{buildroot}%{_libdir}/unit/debug-modules
|
||||||
%{__mkdir} -p %{buildroot}%{_sharedstatedir}/unit
|
%{__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
|
%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
|
||||||
%{__install} -m 644 -p %{SOURCE3} \
|
%{__install} -m 644 -p %{SOURCE3} \
|
||||||
%{buildroot}%{_sysconfdir}/sysconfig/unit
|
%{buildroot}%{_sysconfdir}/sysconfig/unitd
|
||||||
|
%endif
|
||||||
|
%{__mkdir} -p %{buildroot}%{_sysconfdir}/logrotate.d
|
||||||
|
%{__install} -m 644 -p %{SOURCE5} \
|
||||||
|
%{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 %{SOURCE4} \
|
||||||
@@ -185,11 +199,13 @@ fi
|
|||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%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
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/unit
|
|
||||||
%dir %{_sysconfdir}/unit
|
%dir %{_sysconfdir}/unit
|
||||||
%if %{use_systemd}
|
%if %{use_systemd}
|
||||||
%{_unitdir}/unit.service
|
%{_unitdir}/unit.service
|
||||||
|
%dir %attr(0755,root,root) %ghost %{_localstatedir}/run/unit
|
||||||
%else
|
%else
|
||||||
|
%config(noreplace) %{_sysconfdir}/sysconfig/unitd
|
||||||
|
%dir %attr(0755,root,root) %{_localstatedir}/run/unit
|
||||||
%{_initrddir}/unit
|
%{_initrddir}/unit
|
||||||
%endif
|
%endif
|
||||||
%dir %{_datadir}/doc/unit
|
%dir %{_datadir}/doc/unit
|
||||||
@@ -197,6 +213,8 @@ fi
|
|||||||
%dir %{_libdir}/unit/modules
|
%dir %{_libdir}/unit/modules
|
||||||
%dir %{_libdir}/unit/debug-modules
|
%dir %{_libdir}/unit/debug-modules
|
||||||
%dir %{_sharedstatedir}/unit
|
%dir %{_sharedstatedir}/unit
|
||||||
|
%dir %attr(0700,root,root) %{_localstatedir}/log/unit
|
||||||
|
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%{_libdir}/libunit.a
|
%{_libdir}/libunit.a
|
||||||
|
|||||||
Reference in New Issue
Block a user