mariadb11.8/mariadb-scripts.patch
Michal Schorm 9f34c64543 [packaging fix for containers] Drop usage of tmpfiles.d
The 'tmpfiles.d' functionality requires 'systemd'.
That is inappropriate for container use-cases, where
we can save 15-20 MB by removal for the systemd stack.

In the case of MariaDB, we
1) were NOT using the upstream tpmfiles.d config
2) we were used downstream tmpfiles.d config
2.a) which only contained creation of the PID file dir (/var/run/mariadb)

This can be easily replaced by RPM creating and owning the path.

By closer inspection I found that we do it already, so the current tmpfiles.d config
just do entirely redundant job. I assume this was an overlook when the tmpfiles.d config
was introduced.

This commit:
1) removes the donwstream tmpfiles.d config file
2) sets "INSTALL_SYSTEMD_TMPFILESDIR" CMake option to an empty string
   to disable generating the upstream config file
3) Drops the "Requires" to 'systemd' to "Recommends"
   so the systemd can be ommited in containers, but is still installed by default
4) Drops the '%{?systemd_requires}' macro, which makes sure the systemd is present
   for it's %post, %preun and %postun scriptlets.

   This can only happen when someone calls the installation or removal on a system that does not
   have systemd, which is highly, highly unlikely nowadays.

   And in the cases where it is expected - e.g. containers - the %systemd-{post,preun,postun} marcos
   contains a condition that makes sure it's content is only run when the systemd is present,
   so the effective functionality remains unchanged.
2025-05-05 12:13:17 +02:00

41 lines
1.3 KiB
Diff

We have some downstream patches and other scripts that include variables to
be expanded by cmake. Cmake needs to know about them, so adding them manually.
# Install libgcc as mylibgcc.a
--- mariadb-10.5.5/scripts/CMakeLists.txt.old 2020-09-24 10:13:35.272589689 +0200
+++ mariadb-10.5.5/scripts/CMakeLists.txt 2020-09-24 10:17:31.428985798 +0200
@@ -377,6 +377,33 @@
INSTALL_LINK(${file} ${binname} ${INSTALL_BINDIR} ${${file}_COMPONENT})
ENDIF()
ENDFOREACH()
+
+ # files for systemd
+ SET(SYSTEMD_SCRIPTS
+ mysql.service
+ mysql@.service
+ mariadb-prepare-db-dir
+ mariadb-check-socket
+ mariadb-check-upgrade
+ mariadb-scripts-common
+ mysql_config_multilib
+ clustercheck
+ galera_new_cluster
+ my.cnf
+ )
+ FOREACH(file ${SYSTEMD_SCRIPTS})
+ IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
+ ELSEIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.in)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${file} ESCAPE_QUOTES @ONLY)
+ ELSE()
+ MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file}.in in "
+ "${CMAKE_CURRENT_SOURCE_DIR}" )
+ ENDIF()
+ ENDFOREACH()
+
ENDIF()
# Install libgcc as mylibgcc.a