From 25f598f54feb71d0752e851147495f2fabf12b7b Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Tue, 16 Nov 2021 12:53:51 +0200 Subject: MDEV-26317: Add SYSTEMD_READWRITEPATH variable to mariadb.service.in-file Add SYSTEMD_READWRITEPATH-variable to mariadb{@,}.service.in to make sure that if one is not building RPM or DEB packages then make sure there is ReadWritePaths directive is defined in systemd service file. This ensures that tar-ball installation has permissions to write database default installation path (default: /usr/local/mysql/data) even if it's located under /usr. Writing to that location is prevented by 'ProtectSystem=full' systemd directive by default. Prefixing the path with "-" in systemd causes there to not be an error if the path doesn't exist. This may occur if the user has configured a datadir elsewhere. Reviewer: Daniel Black --- cmake/systemd.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cmake') diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake index 978be0b9f98..0640b5432bb 100644 --- a/cmake/systemd.cmake +++ b/cmake/systemd.cmake @@ -49,6 +49,12 @@ MACRO(CHECK_SYSTEMD) SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld") SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=/etc/mysql/debian-start") ENDIF() + IF(NOT DEB AND NOT RPM) + SET(SYSTEMD_READWRITEPATH "# Database dir: '${MYSQL_DATADIR}' should be writable even +# ProtectSystem=full prevents it +ReadWritePaths=-${MYSQL_DATADIR}\n") + ENDIF() + MESSAGE_ONCE(systemd "Systemd features enabled") ELSE() UNSET(LIBSYSTEMD) -- cgit v1.2.1