From 9fa6875d7d39f2bd02be9d273c83313548a6d6d5 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Sat, 1 Nov 2025 16:59:06 -0500 Subject: [PATCH] Fixed packaging to handle cf-php-fpm sysvinit script properly for client and hub /etc/init.d/cf-php-fpm script is always installed via core but causes trouble during packaging on redhat-7 and should be removed for all client packages. Ticket: ENT-13319 Changelog: none --- .../cfengine-community/cfengine-community.spec.in | 10 ++++++---- .../cfengine-nova-hub/cfengine-nova-hub.spec.in | 12 ++++++++---- packaging/cfengine-nova/cfengine-nova.spec.aix.in | 3 +++ packaging/cfengine-nova/cfengine-nova.spec.in | 3 +++ packaging/cfengine-nova/debian/rules | 3 ++- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/packaging/cfengine-community/cfengine-community.spec.in b/packaging/cfengine-community/cfengine-community.spec.in index 55a1b2eda..293d8d2ad 100644 --- a/packaging/cfengine-community/cfengine-community.spec.in +++ b/packaging/cfengine-community/cfengine-community.spec.in @@ -63,10 +63,11 @@ rm -f $RPM_BUILD_ROOT%{prefix}/bin/curl rm -f $RPM_BUILD_ROOT%{prefix}/bin/wcurl rm -rf $RPM_BUILD_ROOT%{prefix}/ssl -# For el9+ and suse-15+ we started seeing issues from other packages not expecting init scripts -%if %{?rhel}%{!?rhel:0} >= 9 || %{?suse_version}%{!?suse_version:0} >= 1500 +# For el8+ and suse-15+ we started seeing issues from other packages not expecting init scripts +%if %{?rhel}%{!?rhel:0} >= 8 || %{?suse_version}%{!?suse_version:0} >= 1500 rm -f $RPM_BUILD_ROOT/etc/sysconfig/cfengine3 rm -f $RPM_BUILD_ROOT/etc/init.d/cfengine3 +rm -f $RPM_BUILD_ROOT/etc/init.d/cf-php-fpm rm -f $RPM_BUILD_ROOT/etc/profile.d/cfengine3.sh %endif @@ -149,12 +150,13 @@ done %endif # Globally installed configs, scripts -%if %{?rhel}%{!?rhel:0} < 9 && %{?suse_version}%{!?suse_version:0} < 1500 +%if %{?rhel}%{!?rhel:0} < 8 && %{?suse_version}%{!?suse_version:0} < 1500 %attr(644,root,root) /etc/sysconfig/cfengine3 %attr(755,root,root) /etc/profile.d/cfengine3.sh # ENT-11901 -# For el9+ and suse15+ we started seeing issues from other packages not expecting init scripts +# For el8+ and suse15+ we started seeing issues from other packages not expecting init scripts %attr(755,root,root) /etc/init.d/cfengine3 +%attr(755,root,root) /etc/init.d/cf-php-fpm %endif # Systemd units diff --git a/packaging/cfengine-nova-hub/cfengine-nova-hub.spec.in b/packaging/cfengine-nova-hub/cfengine-nova-hub.spec.in index 74ace020d..0a95de657 100644 --- a/packaging/cfengine-nova-hub/cfengine-nova-hub.spec.in +++ b/packaging/cfengine-nova-hub/cfengine-nova-hub.spec.in @@ -82,10 +82,12 @@ cp -a %{prefix}/* $RPM_BUILD_ROOT%{prefix} cp -a %{_basedir}/cfengine/dist/* $RPM_BUILD_ROOT # ENT-11901 -# For el9+ we started seeing issues from other packages not expecting init scripts -%if %{?rhel}%{!?rhel:0} >= 9 +# For el8+ we started seeing issues from other packages not expecting init scripts +# If sysvinit scripts other than cfengine3 are present, such as cf-php-fpm, they will fail with systemctl operations due to not supporting chkconfig. +%if %{?rhel}%{!?rhel:0} >= 8 rm -f $RPM_BUILD_ROOT/etc/sysconfig/cfengine3 rm -f $RPM_BUILD_ROOT/etc/init.d/cfengine3 +rm -f $RPM_BUILD_ROOT/etc/init.d/cf-php-fpm rm -f $RPM_BUILD_ROOT/etc/profile.d/cfengine.sh %endif # Remove useless stuff @@ -347,9 +349,11 @@ exit 0 # Initscript, other configuration %defattr(755,root,root,755) # ENT-11901 -# For el9+ we started seeing issues from other packages not expecting init scripts -%if %{?rhel}%{!?rhel:0} < 9 +# For el8+ we started seeing issues from other packages not expecting init scripts +# ENT-13319 we found that rhel-8 also exhibited this behavior so adjusted el9+ to el8+ +%if %{?rhel}%{!?rhel:0} < 8 /etc/init.d/cfengine3 +/etc/init.d/cf-php-fpm /etc/profile.d/cfengine.sh %attr(644,root,root) /etc/sysconfig/cfengine3 %endif diff --git a/packaging/cfengine-nova/cfengine-nova.spec.aix.in b/packaging/cfengine-nova/cfengine-nova.spec.aix.in index aff7e6fd0..1fae9f57d 100644 --- a/packaging/cfengine-nova/cfengine-nova.spec.aix.in +++ b/packaging/cfengine-nova/cfengine-nova.spec.aix.in @@ -42,6 +42,9 @@ rm -f $RPM_BUILD_ROOT%{prefix}/bin/openssl rm -f $RPM_BUILD_ROOT%{prefix}/bin/curl rm -rf $RPM_BUILD_ROOT%{prefix}/ssl +# For client we never want hub-specific things +rm -f $RPM_BUILD_ROOT/init.d/cf-php-fpm + %clean rm -rf $RPM_BUILD_ROOT diff --git a/packaging/cfengine-nova/cfengine-nova.spec.in b/packaging/cfengine-nova/cfengine-nova.spec.in index c6bd7fc16..94bb72cf6 100644 --- a/packaging/cfengine-nova/cfengine-nova.spec.in +++ b/packaging/cfengine-nova/cfengine-nova.spec.in @@ -57,6 +57,9 @@ mkdir -p $RPM_BUILD_ROOT%{prefix} cp -a %{prefix}/* $RPM_BUILD_ROOT%{prefix} cp -a %{_basedir}/cfengine/dist/* $RPM_BUILD_ROOT +# for cfengine-nova (client) we never want cf-php-fpm service, that is only for cfengine-nova-hub +rm -f $RPM_BUILD_ROOT/etc/init.d/cf-php-fpm + # ENT-11901 # For el9+ and suse-15+ we started seeing issues from other packages not expecting init scripts %if %{?rhel}%{!?rhel:0} >= 9 || %{?suse_version}%{!?suse_version:0} >= 1500 diff --git a/packaging/cfengine-nova/debian/rules b/packaging/cfengine-nova/debian/rules index f6b777cc9..ff362457d 100755 --- a/packaging/cfengine-nova/debian/rules +++ b/packaging/cfengine-nova/debian/rules @@ -38,7 +38,8 @@ install: build rm -f $(CURDIR)/debian/tmp$(PREFIX)/bin/openssl rm -f $(CURDIR)/debian/tmp$(PREFIX)/bin/curl rm -rf $(CURDIR)/debian/tmp$(PREFIX)/ssl - +# remove hub-specific files + rm -f $(CURDIR)/debian/tmp/etc/init.d/cf-php-fpm # Debian is different