diff options
author | Rafli Akmal <thefallenrat@artixlinux.org> | 2017-12-28 22:19:28 +0800 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2020-01-24 14:07:19 +0200 |
commit | 742c36d048e00c8f1106433ef9a73d445e6a8083 (patch) | |
tree | b373ea7d23cee07d42dd238e868d65e179da05ed | |
parent | b472bc2eba017b3286dc7110f1c2ce3a039e6ac7 (diff) | |
download | mariadb-git-742c36d048e00c8f1106433ef9a73d445e6a8083.tar.gz |
MDEV-15052: Allow sysusers and tmpfiles install for non-systemd users
..as they have their own tools that parses those files, such as
opensysusers[1] that handles sysusers file and opentmpfiles[2] that
handles tmpfiles.d settings
Because of this. Move both sysusers and tmpfiles 'if' function
outside systemd function, allowing independent install
Signed-off-by: Rafli Akmal <thefallenrat@artixlinux.org>
[1] - https://github.com/artix-linux/opensysusers
[2] - https://github.com/OpenRC/opentmpfiles
Changes done by vicentiu@mariadb.org, from original author patch:
Installing sysusers and tmpfiles without checking for systemd existence
means that by default, cmake will ALWAYS install these files. Our
general policy is we do not install things which are not needed.
However, there is a valid use case when these files are useful, as is
described above.
To allow this, provide an extra switch that can be enabled during
configuring by doing -DINSTALL_SYSTEMD_{SYSUSERS|TMPFILES}=True
This will use the default path INSTALL_SYSTEMD_{SYSUSERS|TMPFILES}DIR
fetched from install_layout.cmake for rpm & deb based layouts
respectively, or they must be overriden if the install_layout is
standalone.
Example:
cmake . -DINSTALL_SYSTEMD_SYSUSERS=True -DINSTALL_SYSTEMD_SYSUSERSDIR=/etc/sysusers.d
-rw-r--r-- | support-files/CMakeLists.txt | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt index b3162f484ce..363646a0647 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt @@ -114,23 +114,6 @@ IF(UNIX) ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service DESTINATION ${inst_location}/systemd COMPONENT SupportFiles) - IF(INSTALL_SYSTEMD_SYSUSERSDIR) - CONFIGURE_FILE(sysusers.conf.in - ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf - DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR} - RENAME mariadb.conf COMPONENT Server) - ENDIF() - - IF(INSTALL_SYSTEMD_TMPFILESDIR) - get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY) - CONFIGURE_FILE(tmpfiles.conf.in - ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf - DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR} - RENAME mariadb.conf COMPONENT Server) - ENDIF() - # @ in directory name broken between CMake version 2.8.12.2 and 3.3 # http://public.kitware.com/Bug/view.php?id=14782 IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM) @@ -157,6 +140,26 @@ IF(UNIX) ENDIF() ENDIF() + # Allow installing sysusers and tmpusers without requiring SYSTEMD on the + # system. This is useful for distributions running other init systems to + # parse these files and create appropriate users & tmpfiles. + IF((HAVE_SYSTEMD OR INSTALL_SYSTEMD_SYSUSERS) AND INSTALL_SYSTEMD_SYSUSERSDIR) + CONFIGURE_FILE(sysusers.conf.in + ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf + DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR} + RENAME mariadb.conf COMPONENT Server) + ENDIF() + + IF((HAVE_SYSTEMD OR INSTALL_SYSTEMD_TMPUSERS) AND INSTALL_SYSTEMD_TMPFILESDIR) + get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY) + CONFIGURE_FILE(tmpfiles.conf.in + ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf + DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR} + RENAME mariadb.conf COMPONENT Server) + ENDIF() + IF (INSTALL_SYSCONFDIR) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d RENAME mysql COMPONENT SupportFiles) |