From ec97549a56a5612582fe19627ebe5a82bda5411d Mon Sep 17 00:00:00 2001 From: Mikhail Novosyolov Date: Sat, 27 Nov 2021 16:58:21 +0300 Subject: [PATCH] Fix php-fpm: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix tmpfiles command (add ".conf" suffix) ``` Запуск скриптлета: php-fpm-3:7.4.24-1.x86_64 2/2 Failed to open 'php-fpm': No such file or directory ``` - avoid rpm-helper - reuse existing apache user/group - use macro for system directory --- php7.spec | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/php7.spec b/php7.spec index 6de59cc..287c6b7 100644 --- a/php7.spec +++ b/php7.spec @@ -27,7 +27,7 @@ Summary: The PHP7 scripting language Name: php Version: 7.4.24 -Release: 2 +Release: 3 Source0: http://ch1.php.net/distributions/php-%{version}.tar.xz Source1: macros.php Group: Development/PHP @@ -1104,10 +1104,6 @@ create and read zip files using the libzip library. %package fpm Summary: PHP7 FastCGI Process Manager Group: Development/Other -Requires(post): rpm-helper -Requires(preun): rpm-helper -Requires(pre): rpm-helper -Requires(postun): rpm-helper Requires: %{libname} >= %{EVRD} Requires: %{name}-ctype >= %{EVRD} Requires: %{name}-filter >= %{EVRD} @@ -1127,6 +1123,9 @@ Requires: %{name}-xmlreader >= %{EVRD} Requires: %{name}-xmlwriter >= %{EVRD} Requires: %{name}-zlib >= %{EVRD} Requires: %{name}-xml >= %{EVRD} +Requires(pre): user(apache) +Requires(pre): group(apache) +Requires(post): /bin/systemd-tmpfiles Provides: %{name} = %{EVRD} %description fpm @@ -1558,7 +1557,7 @@ install -m0644 scripts/man1/phpize.1 %{buildroot}%{_mandir}/man1/ install -m0644 scripts/man1/php-config.1 %{buildroot}%{_mandir}/man1/ # fpm -install -d %{buildroot}/lib/systemd/system +install -d %{buildroot}%{_unitdir} install -d %{buildroot}%{_sysconfdir}/logrotate.d install -d %{buildroot}%{_sysconfdir}/sysconfig install -d %{buildroot}%{_sysconfdir}/php-fpm.d @@ -1574,7 +1573,7 @@ echo "; place your config here" > %{buildroot}%{_sysconfdir}/php-fpm.d/default.c ./libtool --silent --mode=install install sapi/fpm/php-fpm %{buildroot}%{_sbindir}/php-fpm install -m0644 sapi/fpm/php-fpm.8 %{buildroot}%{_mandir}/man8/ install -m0644 sapi/fpm/php-fpm.conf %{buildroot}%{_sysconfdir}/ -install -m0644 php-fpm.service %{buildroot}/lib/systemd/system/ +install -m0644 php-fpm.service %{buildroot}%{_unitdir}/ install -m0644 php-fpm.sysconf %{buildroot}%{_sysconfdir}/sysconfig/php-fpm install -m0644 php-fpm.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/php-fpm @@ -2328,31 +2327,18 @@ if [ "$1" = "0" ]; then fi %post fpm -%tmpfiles_create php-fpm -%_post_service php-fpm +%tmpfiles_create php-fpm.conf if [ $1 = 1 ]; then # Initial installation /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi - -%pre fpm -%_preun_service php-fpm -%_pre_useradd apache /var/www /bin/sh +%systemd_post php-fpm.service %preun fpm -if [ $1 = 0 ]; then - # Package removal, not upgrade - /bin/systemctl --no-reload disable php-fpm.service >/dev/null 2>&1 || : - /bin/systemctl stop php-fpm.service >/dev/null 2>&1 || : -fi +%systemd_preun php-fpm.service %postun fpm /bin/systemctl daemon-reload >/dev/null 2>&1 || : -if [ $1 -ge 1 ]; then - # Package upgrade, not uninstall - /bin/systemctl try-restart php-fpm.service >/dev/null 2>&1 || : -fi -%_postun_userdel apache %post -n apache-mod_php /bin/systemctl daemon-reload >/dev/null 2>&1 || : @@ -2633,7 +2619,7 @@ fi %files fpm %doc sapi/fpm/LICENSE -/lib/systemd/system/php-fpm.service +%{_unitdir}/php-fpm.service %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/php-fpm.conf %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/php-fpm %attr(0644,root,root) %{_sysconfdir}/logrotate.d/php-fpm