summaryrefslogtreecommitdiffstats
path: root/unit.spec
diff options
context:
space:
mode:
Diffstat (limited to 'unit.spec')
-rw-r--r--unit.spec88
1 files changed, 36 insertions, 52 deletions
diff --git a/unit.spec b/unit.spec
index c45ecfa..05252f2 100644
--- a/unit.spec
+++ b/unit.spec
@@ -1,24 +1,22 @@
# remirepo/fedora spec file for unit-php
#
-# Copyright (c) 2019-2020 Remi Collet
+# Copyright (c) 2019-2021 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
+%bcond_without tests
+
%global gh_owner nginx
%global project unit
-%global gh_commit 9e85732e9a8435b059d627b3c264549c33678f74
+%global gh_commit 98228f8ac878799e8265658d990bbff94675856b
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
-# distribution specific definitions
-%global use_systemd (0%{?rhel} >= 7 || 0%{?fedora} >= 19)
-%global with_tests 0%{!?_without_tests:1}
-
Name: unit
Summary: NGINX Unit application server
-Version: 1.21.0
+Version: 1.22.0
Release: 1%{?dist}
License: ASL 2.0
URL: https://unit.nginx.org/
@@ -32,20 +30,14 @@ Source4: unit.logrotate
# Use system crypto policy
Patch0: https://github.com/nginx/unit/pull/215.patch
+BuildRequires: make
BuildRequires: gcc
BuildRequires: openssl-devel
BuildRequires: pcre2-devel
-%if %{use_systemd}
BuildRequires: systemd
-Requires(post): systemd
-Requires(preun): systemd
-Requires(postun): systemd
-%else
-Requires(post): chkconfig
-Requires(preun): chkconfig
-Requires(preun): initscripts
-Requires(postun): initscripts
-%endif
+
+%{?systemd_requires}
+Requires(pre): /usr/sbin/useradd
Requires: logrotate
Provides: nginx-unit = %{version}-%{release}
@@ -84,15 +76,12 @@ unitconf() {
--libdir=%{_libdir} \
--prefix=%{_prefix} \
--state=%{_sharedstatedir}/unit \
-%if %{use_systemd}
--control="unix:/run/unit/control.sock" \
--pid=/run/unit/unit.pid \
-%else
- --control="unix:/var/run/unit/control.sock" \
- --pid=/var/run/unit/unit.pid \
-%endif
--log=/var/log/unit/unit.log \
--tmp=/var/tmp \
+ --user=unit \
+ --group=unit \
--openssl \
--cc-opt="%{optflags}" \
--tests \
@@ -127,50 +116,48 @@ mkdir -p %{buildroot}%{_localstatedir}/run/%{name}
install -p -D -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# init scripts
-%if %{use_systemd}
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
mkdir -p %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d
-%else
-install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/unitd
-install -p -D -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}
-%endif
-
%check
-%if %{with_tests}
+%if %{with tests}
make tests %{?_smp_mflags}
./build/tests
%endif
+%pre
+getent group unit >/dev/null || groupadd -r unit
+getent passwd unit >/dev/null || \
+ useradd -r -g unit -s /sbin/nologin \
+ -d /nonexistent -c "unit user" unit
+
%post
-%if %{use_systemd}
%systemd_post %{name}.service
-%else
-/sbin/chkconfig --add unit
-%endif
%preun
-%if %{use_systemd}
%systemd_preun %{name}.service
-%else
-if [ $1 -eq 0 ]; then
- /sbin/service unit stop >/dev/null 2>&1
- /sbin/chkconfig --del unit
-fi
-%endif
%postun
-%if %{use_systemd}
%systemd_postun_with_restart %{name}.service
-%else
-if [ $1 -ge 1 ]; then
- /sbin/service unit condrestart >/dev/null 2>&1 ||:
-fi
-%endif
+%triggerpostun -- unit < 1.22.0
+cat <<BANNER
+----------------------------------------------------------------------
+
+WARNING:
+
+Since version 1.22.0, Unit's non-privileged processes run as unit:unit by
+default. Review your system permissions and Unit configuration so apps and
+routes that relied on these processes running as nobody:nogroup stay working.
+
+More info: https://unit.nginx.org/installation/#official-packages
+
+----------------------------------------------------------------------
+BANNER
+
%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
@@ -185,16 +172,10 @@ fi
%dir %attr(0700,root,root) %{_localstatedir}/log/unit
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
-%if %{use_systemd}
%dir %{_sysconfdir}/systemd/system/%{name}.service.d
%{_unitdir}/unit.service
%dir %attr(0755,root,root) %ghost /run/unit
-%else
-%config(noreplace) %{_sysconfdir}/sysconfig/unitd
-%dir %attr(0755,root,root) %{_localstatedir}/run/unit
-%{_initrddir}/unit
-%endif
%files devel
# API is not stable YET, so keep the static library for now (like upstream packages)
@@ -204,6 +185,9 @@ fi
%changelog
+* Fri Feb 5 2021 Remi Collet <remi@remirepo.net> - 1.22.0-1
+- update to 1.22.0
+
* Fri Nov 20 2020 Remi Collet <remi@remirepo.net> - 1.21.0-1
- update to 1.21.0