Pre-create directory for acme, fix mess with temporary files in /usr/share/angie/

Tested both upgrading and clean installations, works OK.
This commit is contained in:
Mikhail Novosyolov 2024-04-06 12:08:02 +03:00
parent 9e868a33ce
commit 57260deff8
2 changed files with 26 additions and 19 deletions

View file

@ -1,9 +1,12 @@
# See also the official SRPM:
# https://download.angie.software/angie/rosa/2021.1/source/
%global _disable_ld_no_undefined 1
%define angie_user angie
%define angie_group %{angie_user}
%define angie_home /var/lib/angie
%define angie_home_tmp %{angie_home}/tmp
%define angie_rootdir /var/lib/angie
%define angie_cache /var/cache/angie
%define angie_logdir /var/log/angie
%define angie_confdir %{_sysconfdir}/angie
%define angie_datadir %{_datadir}/angie
@ -70,7 +73,11 @@ BuildRequires: pkgconfig(libbrotlienc)
BuildRequires: pam-devel
# for spnego-http-auth-angie-module
BuildRequires: pkgconfig(krb5)
Requires(pre): /usr/bin/systemd-sysusers
%if %{mdvver} >= 202310
Requires(post): /usr/bin/systemd-sysusers
%else
Requires(post): /bin/systemd-sysusers
%endif
Requires: logrotate
Provides: webserver
@ -111,18 +118,13 @@ nginx configuration without major changes.
%config(noreplace) %{angie_confdir}/prometheus_all.conf
%config(noreplace) %{angie_confdir}/prometheus_all.conf.default
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%attr(-,%{angie_user},%{angie_group}) %dir %{angie_home}
%attr(-,%{angie_user},%{angie_group}) %dir %{angie_home_tmp}
%attr(-,%{angie_user},%{angie_group}) %dir %{angie_logdir}
%pre
# https://nixtux.ru/1002
%{expand:
%(echo '%{sysusers_create_package %{name} %{SOURCE6}}' | \
sed -e 's,@angie_home@,%{angie_home},g' -e 's,@angie_user@,%{angie_user},g' -e 's,@angie_group@,%{angie_group},g')
}
%dir %{angie_rootdir}
%attr(0700,root,root) %dir %{angie_rootdir}/acme
%dir %{angie_cache}
%dir %{angie_logdir}
%post
%sysusers_create %{name}.conf
%systemd_post angie.service
%preun
@ -338,9 +340,12 @@ fi
--conf-path=%{angie_confdir}/%{name}.conf \
--error-log-path=%{angie_logdir}/error.log \
--http-log-path=%{angie_logdir}/access.log \
--http-client-body-temp-path=%{angie_home_tmp}/client_body \
--http-proxy-temp-path=%{angie_home_tmp}/proxy \
--http-fastcgi-temp-path=%{angie_home_tmp}/fastcgi \
--http-acme-client-path=%{angie_rootdir}/acme \
--http-client-body-temp-path=%{angie_cache}/client_temp \
--http-fastcgi-temp-path=%{angie_cache}/fastcgi_temp \
--http-proxy-temp-path=%{angie_cache}/proxy_temp \
--http-scgi-temp-path=%{angie_cache}/scgi_temp \
--http-uwsgi-temp-path=%{angie_cache}/uwsgi_temp \
--pid-path=/var/run/%{name}.pid \
--lock-path=/var/lock/subsys/%{name} \
--modules-path=%{angie_modpath} \
@ -375,7 +380,9 @@ chmod 0755 %{buildroot}%{_sbindir}/angie
install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/angie.service
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -p -d -m 0755 %{buildroot}%{angie_home_tmp}
install -p -d -m 0755 %{buildroot}%{angie_cache}
install -p -d -m 0755 %{buildroot}%{angie_rootdir}
install -p -d -m 0755 %{buildroot}%{angie_rootdir}/acme
install -p -d -m 0755 %{buildroot}%{angie_logdir}
install -p -d -m 0755 %{buildroot}%{angie_webroot}
@ -397,7 +404,7 @@ install -m0644 man/*.8 %{buildroot}%{_mandir}/man8/
mkdir -p %{buildroot}%{_sysusersdir}
install -m0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/%{name}.conf
sed -i %{buildroot}%{_sysusersdir}/%{name}.conf \
-e 's,@angie_home@,%{angie_home},g' \
-e 's,@angie_cache@,%{angie_cache},g' \
-e 's,@angie_user@,%{angie_user},g' \
-e 's,@angie_group@,%{angie_group},g'
! grep -q '@' %{buildroot}%{_sysusersdir}/%{name}.conf

View file

@ -1,3 +1,3 @@
u @angie_user@ - "Angie" @angie_home@
u @angie_user@ - "Angie" @angie_cache@
g @angie_group@ - -
m @angie_user@ @angie_group@