author | Christian Hesse
<eworm@archlinux.org> 2019-06-21 10:06:42 UTC |
committer | Christian Hesse
<eworm@archlinux.org> 2019-06-21 10:06:42 UTC |
parent | 0852bdabb3715591221ce9fc57c36fbf6d82f379 |
0001-arch-specific.patch | +0 | -44 |
0002-systemd-sysusers-tmpfiles.patch | +12 | -7 |
0004-do-not-break-main-configuration-with-instantiated-one.patch | +0 | -56 |
0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch | +5 | -3 |
0007-systemd-service-add-instance-name-in-description.patch | +32 | -0 |
PKGBUILD | +25 | -24 |
mariadb.install | +12 | -2 |
diff --git a/0001-arch-specific.patch b/0001-arch-specific.patch index a3396fc..9a0a740 100644 --- a/0001-arch-specific.patch +++ b/0001-arch-specific.patch @@ -66,37 +66,6 @@ index 83d75f80b87..d1d24d685f9 100644 # Flush caches. previously [mysqld_safe] flush-caches=1 # ExecStartPre=sync -From 72b42fb1a344bfc3f3c3c905fe85c93ac4a752e3 Mon Sep 17 00:00:00 2001 -From: Christian Hesse <mail@eworm.de> -Date: Tue, 29 Jan 2019 23:14:23 +0100 -Subject: fix path to our config ---- - support-files/rpm/enable_encryption.preset | 2 +- - support-files/rpm/my.cnf | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/support-files/rpm/enable_encryption.preset b/support-files/rpm/enable_encryption.preset -index 722db7e5fa1..978a7494c6b 100644 ---- a/support-files/rpm/enable_encryption.preset -+++ b/support-files/rpm/enable_encryption.preset -@@ -1,5 +1,5 @@ - # --# !include this file into your my.cnf (or any of *.cnf files in /etc/my.cnf.d) -+# !include this file into your my.cnf (or any of *.cnf files in /etc/mysql/my.cnf.d) - # and it will enable data at rest encryption. This is a simple way to - # ensure that everything that can be encrypted will be and your - # data will not leak unencrypted. -diff --git a/support-files/rpm/my.cnf b/support-files/rpm/my.cnf -index 913b88f8328..17d25361178 100644 ---- a/support-files/rpm/my.cnf -+++ b/support-files/rpm/my.cnf -@@ -7,5 +7,5 @@ - # - # include all files from the config directory - # --!includedir /etc/my.cnf.d -+!includedir /etc/mysql/my.cnf.d - From 820b47c1e70d36f1272cca3ddbdf4bbd2dd62bde Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Wed, 30 Jan 2019 00:46:47 +0100 @@ -118,17 +87,4 @@ index 8d43b6db428..d7fa6bf5b14 100644 -Alias=mysqld.service - [Service] -diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in -index a2f5cff0828..3fc41358e14 100644 ---- a/support-files/mariadb@.service.in -+++ b/support-files/mariadb@.service.in -@@ -27,8 +27,6 @@ ConditionPathExists=@sysconf2dir@/my%I.cnf - - [Install] - WantedBy=multi-user.target --Alias=mysql.service --Alias=mysqld.service - - [Service] diff --git a/0002-systemd-sysusers-tmpfiles.patch b/0002-systemd-sysusers-tmpfiles.patch index c18cff6..aad7d9e 100644 --- a/0002-systemd-sysusers-tmpfiles.patch +++ b/0002-systemd-sysusers-tmpfiles.patch @@ -1,7 +1,8 @@ -From dc7aff5e5331820205282576f6ade015f672969b Mon Sep 17 00:00:00 2001 +From aef4f58adf90e9fee4348c1cf6484faeae159255 Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Tue, 2 Jan 2018 14:32:21 +0100 -Subject: Use descriptive file names for sysusers and tmpfiles configuration +Subject: [PATCH 1/2] Use descriptive file names for sysusers and tmpfiles + configuration These files were installed to: @@ -9,15 +10,17 @@ ${INSTALL_SYSTEMD_SYSUSERSDIR}/sysusers.conf ${INSTALL_SYSTEMD_TMPFILESDIR}/tmpfiles.conf Instead rename the files to more descriptive file names 'mariadb.conf'. + +Signed-off-by: Christian Hesse <mail@eworm.de> --- support-files/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt -index 4ad3810e082..8363922d468 100644 +index 3655c87b94e..63443245e6e 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt -@@ -117,7 +117,8 @@ IF(UNIX) +@@ -118,7 +118,8 @@ IF(UNIX) CONFIGURE_FILE(sysusers.conf.in ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @@ -27,7 +30,7 @@ index 4ad3810e082..8363922d468 100644 ENDIF() IF(INSTALL_SYSTEMD_TMPFILESDIR) -@@ -125,7 +126,8 @@ IF(UNIX) +@@ -126,7 +127,8 @@ IF(UNIX) CONFIGURE_FILE(tmpfiles.conf.in ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @@ -37,16 +40,18 @@ index 4ad3810e082..8363922d468 100644 ENDIF() # @ in directory name broken between CMake version 2.8.12.2 and 3.3 -From c86912c8896b65c1dd9226c1bc2987189d4840c2 Mon Sep 17 00:00:00 2001 +From 974bd397ff3492c57799e11a02cc3c07081bb1fc Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Tue, 2 Jan 2018 14:36:49 +0100 -Subject: Make systemd-tmpfiles create MYSQL_DATADIR +Subject: [PATCH 2/2] Make systemd-tmpfiles create MYSQL_DATADIR This is a no-op if the directory exists, but makes sure it is created by systemd-tmpfiles with proper permissions otherwise. This solves packaging issues when the user MYSQLD_USER is created by systemd-sysusers and uid is not known in advance. + +Signed-off-by: Christian Hesse <mail@eworm.de> --- support-files/tmpfiles.conf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/0004-do-not-break-main-configuration-with-instantiated-one.patch b/0004-do-not-break-main-configuration-with-instantiated-one.patch deleted file mode 100644 index 00da448..0000000 --- a/0004-do-not-break-main-configuration-with-instantiated-one.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 8fe9b2658664d0ece15fe57442706446fed66d6e Mon Sep 17 00:00:00 2001 -From: Christian Hesse <mail@eworm.de> -Date: Tue, 15 Jan 2019 17:22:56 +0100 -Subject: do not break main configuration with instantiated one - -The main configuration file /etc/my.cnf includes all configuration files in -/etc/my.cnf.d/. However an instantiated service mariadb@example.service -reads its configuration from /etc/my.cnf.d/myexample.cnf. This breaks -the main configuration as that includes a snippet intended for an instance. - -This can be fixed by changing the path: Let the instantiated service -read its configuration from /etc/myexample.cnf. ---- - support-files/mariadb@.service.in | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in -index a2f5cff0828..1207e690f47 100644 ---- a/support-files/mariadb@.service.in -+++ b/support-files/mariadb@.service.in -@@ -1,7 +1,7 @@ - # Multi instance version of mariadb. For if you run multiple versions at once. - # Also used for mariadb@bootstrap to bootstrap Galera. - # --# create config file @sysconf2dir@/my{instancename}.cnf -+# create config file @sysconfdir@/my{instancename}.cnf - # - # start as systemctl start mariadb@{instancename}.server - -@@ -23,7 +23,7 @@ Documentation=man:mysqld(8) - Documentation=https://mariadb.com/kb/en/library/systemd/ - After=network.target - --ConditionPathExists=@sysconf2dir@/my%I.cnf -+ConditionPathExists=@sysconfdir@/my%I.cnf - - [Install] - WantedBy=multi-user.target -@@ -75,7 +75,7 @@ PermissionsStartOnly=true - ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I" - - ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ -- VAR=`@bindir@/galera_recovery --defaults-file=@sysconf2dir@/my%I.cnf`; [ $? -eq 0 ] \ -+ VAR=`@bindir@/galera_recovery --defaults-file=@sysconfdir@/my%I.cnf`; [ $? -eq 0 ] \ - && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" - - # Alternate: (remove ConditionPathExists above) -@@ -96,7 +96,7 @@ ExecStartPre=/bin/sh -c "[ ! -e @bindir@/galera_recovery ] && VAR= || \ - - # Note: Place $MYSQLD_OPTS at the very end for its options to take precedence. - --ExecStart=@sbindir@/mysqld --defaults-file=@sysconf2dir@/my%I.cnf \ -+ExecStart=@sbindir@/mysqld --defaults-file=@sysconfdir@/my%I.cnf \ - $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION%I $MYSQLD_OPTS - # Alternate: (remove ConditionPathExists above) - # use [mysqld.INSTANCENAME] as sections in my.cnf diff --git a/0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch b/0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch index f3de571..15203f6 100644 --- a/0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch +++ b/0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch @@ -1,7 +1,7 @@ -From 5936f0be4a49eda7b05ea1591bbbba3d72e4d7b9 Mon Sep 17 00:00:00 2001 +From 471952a37f2523a00d2b4fd617128b3fa9d0cf03 Mon Sep 17 00:00:00 2001 From: Christian Hesse <mail@eworm.de> Date: Fri, 25 Jan 2019 14:50:53 +0100 -Subject: fix galera_recovery with fs.protected_regular enabled +Subject: [PATCH 1/1] fix galera_recovery with fs.protected_regular enabled The fs.protected_regular sysctls was added in Linux 4.19 to make some data spoofing attacks harder. With systemd v241 these will be enabled @@ -12,12 +12,14 @@ With this protection enabled galera_recovery fails with EPERM The script changes ownership of $log_file to $user, though $user never touches it. The shell redirection writes output to the file, not mysqld. So just drop chown to fix this. + +Signed-off-by: Christian Hesse <mail@eworm.de> --- scripts/galera_recovery.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh -index c58f3d8f6b9..c70decc0005 100644 +index 709c4b0eed5..8df2abc3fd5 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -101,8 +101,7 @@ wsrep_recover_position() { diff --git a/0007-systemd-service-add-instance-name-in-description.patch b/0007-systemd-service-add-instance-name-in-description.patch new file mode 100644 index 0000000..7427d8a --- /dev/null +++ b/0007-systemd-service-add-instance-name-in-description.patch @@ -0,0 +1,32 @@ +From 34ac8a4f31f490db5cec7b6291dc98479c45c78f Mon Sep 17 00:00:00 2001 +From: Christian Hesse <mail@eworm.de> +Date: Fri, 1 Mar 2019 10:00:27 +0100 +Subject: [PATCH 1/1] systemd service: add instance name in description + +The unit files made systemd print: + +systemd[1]: Started MariaDB 10.3.13 database server (multi-instance). + +Let's add the instance name, so starting mariadb@foo.service +makes it print: + +systemd[1]: Started MariaDB 10.3.13 database server (multi-instance foo). + +Signed-off-by: Christian Hesse <mail@eworm.de> +--- + support-files/mariadb@.service.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in +index 727c1b85301..fd997b2ce3d 100644 +--- a/support-files/mariadb@.service.in ++++ b/support-files/mariadb@.service.in +@@ -131,7 +131,7 @@ + # systemd.service(5) + + [Unit] +-Description=MariaDB @VERSION@ database server (multi-instance) ++Description=MariaDB @VERSION@ database server (multi-instance %I) + Documentation=man:mysqld(8) + Documentation=https://mariadb.com/kb/en/library/systemd/ + After=network.target diff --git a/PKGBUILD b/PKGBUILD index d349d33..ac450f9 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -4,7 +4,7 @@ pkgbase=mariadb pkgname=('mariadb-libs' 'mariadb-clients' 'mariadb' 'mytop') pkgdesc='Fast SQL database server, derived from MySQL' -pkgver=10.3.16 +pkgver=10.4.6 pkgrel=1 arch=('x86_64') license=('GPL') @@ -15,14 +15,14 @@ validpgpkeys=('199369E5404BD5FC7D2FE43BCBCB082A1BB943DB') # MariaDB Package Sign source=("https://mirrors.n-ix.net/mariadb/mariadb-$pkgver/source/mariadb-$pkgver.tar.gz"{,.asc} '0001-arch-specific.patch' '0002-systemd-sysusers-tmpfiles.patch' - '0004-do-not-break-main-configuration-with-instantiated-one.patch' - '0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch') -sha256sums=('39e9723eaf620afd99b0925b2c2a5a50a89110ba50040adf14cce7cf89e5e21b' + '0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch' + '0007-systemd-service-add-instance-name-in-description.patch') +sha256sums=('a270fe6169a1aaf6f2cbbc945de2c954d818c48e1a0fc02fbed92ecb94678e70' 'SKIP' - '5b74e328e75369dfb68491a06dd53bd736e34f87281103ae0dd2f50401dc70d3' - '1cd009b473d5965c7cbe6d48fff272030a2ccdd9c7e67b4f837d03252786a09a' - 'd12806e4f90cc0fc081205dd4c0a5e0e7c455844f04276811b61b57fd24f5545' - '66e0acac7436fd8925710ef5cc66ba1a8f63a385ce374f01ae83096cc33d97a0') + 'ce72ea1563ad773e00e8b1c299babea176abae1102827c2f743921e9de615041' + '3e83467af80fbd53400a201a34fc858b88509ea8e88b10709947eb66545f9457' + 'c8c801f80924ccb97b499552fe1c532b3ebf8f86cdfc0d23715d4adb1a8810f0' + 'd4575c349fdc6268135cd3483e70e04b149ec8004583bac7f79f190a084cbfc8') prepare() { cd $pkgbase-$pkgver/ @@ -30,7 +30,7 @@ prepare() { # Arch Linux specific patches: # * enable PrivateTmp for a little bit more security # * force preloading jemalloc for memory management - # * fix path to our config + # * remove aliases in systemd unit files patch -Np1 < ../0001-arch-specific.patch # MDEV-17028 Fix glitches with systemd sysusers and tmpfiles: @@ -39,13 +39,13 @@ prepare() { # https://github.com/MariaDB/server/pull/530 patch -Np1 < ../0002-systemd-sysusers-tmpfiles.patch - # do not break main configuration with instantiated one - # https://github.com/MariaDB/server/pull/1095 - patch -Np1 < ../0004-do-not-break-main-configuration-with-instantiated-one.patch - # fix galera_recovery with fs.protected_regular enabled # https://github.com/MariaDB/server/pull/1137 patch -Np1 < ../0005-fix-galera_recovery-with-fs.protected_regular-enabled.patch + + # systemd service: add instance name in description + # https://github.com/MariaDB/server/pull/1216 + patch -Np1 < ../0007-systemd-service-add-instance-name-in-description.patch } build() { @@ -56,8 +56,8 @@ build() { # file paths # /etc - -DINSTALL_SYSCONFDIR=/etc/mysql - -DINSTALL_SYSCONF2DIR=/etc/mysql/my.cnf.d + -DINSTALL_SYSCONFDIR=/etc + -DINSTALL_SYSCONF2DIR=/etc/my.cnf.d # /run -DINSTALL_UNIX_ADDRDIR=/run/mysqld/mysqld.sock # /usr @@ -159,11 +159,11 @@ package_mariadb-clients() { package_mariadb() { pkgdesc='Fast SQL database server, derived from MySQL' - backup=('etc/mysql/my.cnf' - 'etc/mysql/my.cnf.d/client.cnf' - 'etc/mysql/my.cnf.d/enable_encryption.preset' - 'etc/mysql/my.cnf.d/mysql-clients.cnf' - 'etc/mysql/my.cnf.d/server.cnf') + backup=('etc/my.cnf' + 'etc/my.cnf.d/client.cnf' + 'etc/my.cnf.d/enable_encryption.preset' + 'etc/my.cnf.d/mysql-clients.cnf' + 'etc/my.cnf.d/server.cnf') install=mariadb.install depends=("mariadb-clients=${pkgver}" 'inetutils' 'systemd-libs' 'libxml2' 'zstd') optdepends=('galera: for MariaDB cluster with Galera WSREP' @@ -179,7 +179,7 @@ package_mariadb() { cd "$pkgdir" # no SysV init, please! - rm -r etc/mysql/{init.d,logrotate.d} + rm -r etc/logrotate.d rm usr/bin/rcmysql rm usr/share/mysql/{binary-configure,mysql{,d_multi}.server} @@ -205,12 +205,13 @@ package_mariadb() { rm usr/share/man/man1/mysql_config.1 rm -r usr/share/{aclocal,pkgconfig} rm usr/lib/lib* - rm usr/lib/mysql/plugin/{auth_gssapi_client,caching_sha2_password,dialog,mysql_clear_password,sha256_password}.so + rm usr/lib/mysql/plugin/{auth_gssapi_client,caching_sha2_password,client_ed25519,dialog,mysql_clear_password,sha256_password}.so rm -r usr/lib/pkgconfig/ # provided by mariadb-clients - rm usr/bin/{mysql,mysql_plugin,mysql_upgrade,mysqladmin,mysqlbinlog,mysqlcheck,mysqldump,mysqlimport,mysqlshow,mysqlslap,mysqltest} - rm usr/share/man/man1/{mysql,mysql_plugin,mysql_upgrade,mysqladmin,mysqlbinlog,mysqlcheck,mysqldump,mysqlimport,mysqlshow,mysqlslap,mysqltest}.1 + rm usr/bin/mysql{,_plugin,_upgrade,admin,binlog,check,dump,import,show,slap,test} + rm usr/bin/mariadb{,-{admin,binlog,check,dump,import,plugin,show,slap,test,upgrade}} + rm usr/share/man/man1/mysql{,_plugin,_upgrade,admin,binlog,check,dump,import,show,slap,test}.1 # provided by mytop rm usr/bin/mytop diff --git a/mariadb.install b/mariadb.install index b6d9f98..8a3f2d8 100644 --- a/mariadb.install +++ b/mariadb.install @@ -3,13 +3,23 @@ post_install() { echo ":: You need to initialize the MariaDB data directory prior to starting" echo " the service. This can be done with mysql_install_db command, e.g.:" - echo " mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql" + echo " mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql" } post_upgrade() { # show for feature release: 10.1 -> 10.2 -> 10.3 -> ... if [ $(vercmp "${1%.*-*}" "${2%.*-*}") -ne 0 ]; then echo ":: MariaDB was updated to a new feature release. To update the data run:" - echo " systemctl restart mariadb.service && mysql_upgrade -u root -p" + echo " systemctl restart mariadb.service && mariadb-upgrade -u root -p" fi + + # return if old package version greater 10.4... + (( $(vercmp $2 '10.4') > 0 )) && return + + # upgrade from pre-10.4... + echo ":: MariaDB configuration layout changed." + echo " -> The main configuration file now is: /etc/my.cnf" + echo " -> Instantiated services (mariadb@foo.service) do not longer read their" + echo " own configuration file but use group suffix (configuration block" + echo " '[mysqld.foo]') in main configuration file." }