[arch-commits] Commit in mariadb/trunk (5 files)

Christian Hesse eworm at archlinux.org
Thu Jun 30 12:36:45 UTC 2016


    Date: Thursday, June 30, 2016 @ 12:36:44
  Author: eworm
Revision: 270809

enable upstream systemd support, use sysusers

Added:
  mariadb/trunk/mariadb-sysusers.conf
Modified:
  mariadb/trunk/PKGBUILD
  mariadb/trunk/mariadb.install
Deleted:
  mariadb/trunk/mariadb-post.sh
  mariadb/trunk/mariadb.service

-----------------------+
 PKGBUILD              |   30 +++++++++++++++++++++---------
 mariadb-post.sh       |    8 --------
 mariadb-sysusers.conf |    1 +
 mariadb.install       |   22 ++++++++++++++--------
 mariadb.service       |   16 ----------------
 5 files changed, 36 insertions(+), 41 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2016-06-30 10:34:33 UTC (rev 270808)
+++ PKGBUILD	2016-06-30 12:36:44 UTC (rev 270809)
@@ -1,5 +1,6 @@
 # $Id$
 # Maintainer: Bartłomiej Piotrowski <bpiotrowski at archlinux.org>
+# Maintainer: Christian Hesse <mail at eworm.de>
 
 pkgbase=mariadb
 pkgname=('libmariadbclient' 'mariadb-clients' 'mytop' 'mariadb')
@@ -10,15 +11,23 @@
 license=('GPL')
 url='http://mariadb.org/'
 makedepends=('cmake' 'zlib' 'libaio' 'libxml2' 'openssl' 'pcre' 'jemalloc'
-             'lz4' 'boost' 'libevent')
-source=(http://ftp.heanet.ie/mirrors/mariadb/mariadb-$pkgver/source/mariadb-$pkgver.tar.gz mariadb.service
-        mariadb-post.sh
+             'lz4' 'boost' 'libevent' 'systemd')
+source=(http://ftp.heanet.ie/mirrors/mariadb/mariadb-$pkgver/source/mariadb-$pkgver.tar.gz
+        mariadb-sysusers.conf
         mariadb-tmpfile.conf)
 md5sums=('294925531e0fd2f0461e3894496a5adc'
-         'd488fffa9f62f9949c4aa1bb6e6db692'
-         'b79e65a5aa536e6b5bc60988eb0b78a2'
+         '97364065dd980909e04f97821a037ab0'
          '2fa6e456964d4ff5e6d4f9ff0126aed6')
 
+prepare() {
+  # Changes to the upstream unit files:
+  #  * remove the alias from unit files, we install symlinks in package function
+  #  * enable PrivateTmp for a little bit more security
+  sed -i -e '/^Alias/d' \
+    -e '/^PrivateTmp/c PrivateTmp=true' \
+    $pkgbase-$_pkgver/support-files/mariadb{,@}.service
+}
+
 build() {
   mkdir build
   cd build
@@ -44,6 +53,8 @@
     -DINSTALL_MYSQLSHAREDIR=share/mysql \
     -DINSTALL_DOCDIR=share/mysql/docs \
     -DINSTALL_SHAREDIR=share/mysql \
+    -DINSTALL_SYSTEMD_UNITDIR=/usr/lib/systemd/system/ \
+    -DWITH_SYSTEMD=yes \
     -DWITH_READLINE=ON \
     -DWITH_ZLIB=system \
     -DWITH_SSL=system \
@@ -122,7 +133,7 @@
   backup=('etc/mysql/my.cnf')
   install=mariadb.install
   depends=('mariadb-clients' 'inetutils' 'libaio' 'libxml2' 'pcre' 'jemalloc'
-           'lz4' 'boost-libs' 'lzo' 'libevent')
+           'lz4' 'boost-libs' 'lzo' 'libevent' 'libsystemd')
   optdepends=('perl-dbd-mysql: for mysqlhotcopy, mysql_convert_table_format and mysql_setpermission')
   conflicts=('mysql')
   provides=("mysql=$pkgver")
@@ -132,9 +143,10 @@
   make DESTDIR="$pkgdir" install
 
   install -Dm644 "$pkgdir"/usr/share/mysql/my-medium.cnf "$pkgdir"/etc/mysql/my.cnf
-  install -Dm755 ../mariadb-post.sh "$pkgdir"/usr/bin/mysqld-post
-  install -Dm644 ../mariadb.service "$pkgdir"/usr/lib/systemd/system/mysqld.service
-  install -Dm644 ../mariadb-tmpfile.conf "$pkgdir"/usr/lib/tmpfiles.d/mysql.conf
+  install -Dm644 ../mariadb-tmpfile.conf "$pkgdir"/usr/lib/tmpfiles.d/mariadb.conf
+  install -Dm644 ../mariadb-sysusers.conf "$pkgdir"/usr/lib/sysusers.d/mariadb.conf
+  ln -s mariadb.service "$pkgdir"/usr/lib/systemd/system/mysqld.service
+  ln -s mariadb at .service "$pkgdir"/usr/lib/systemd/system/mysqld at .service
 
   install -dm700 "$pkgdir"/var/lib/mysql
   chown -R 89:89 "$pkgdir"/var/lib/mysql &>/dev/null

Deleted: mariadb-post.sh
===================================================================
--- mariadb-post.sh	2016-06-30 10:34:33 UTC (rev 270808)
+++ mariadb-post.sh	2016-06-30 12:36:44 UTC (rev 270809)
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-while true; do
-    response=$(/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1) && break
-    echo "$response" | grep -q "mysqld is alive" && break
-    echo "$response" | grep -q "Access denied for user" && break 
-    sleep 1
-done

Added: mariadb-sysusers.conf
===================================================================
--- mariadb-sysusers.conf	                        (rev 0)
+++ mariadb-sysusers.conf	2016-06-30 12:36:44 UTC (rev 270809)
@@ -0,0 +1 @@
+u mysql 89 "MariaDB" /var/lib/mysql

Modified: mariadb.install
===================================================================
--- mariadb.install	2016-06-30 10:34:33 UTC (rev 270808)
+++ mariadb.install	2016-06-30 12:36:44 UTC (rev 270809)
@@ -1,21 +1,27 @@
 post_install(){
-  groupadd -g 89 mysql &>/dev/null
-  useradd -u 89 -g 89 -d /var/lib/mysql -s /bin/false mysql &>/dev/null
+  if hash systemd-sysusers &> /dev/null; then
+    systemd-sysusers mariadb.conf
+  fi
 
+  if hash systemd-tmpfiles &> /dev/null; then
+    systemd-tmpfiles --create mariadb.conf
+  fi
+
   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"
 
-  if hash systemd-tmpfiles &> /dev/null; then
-    systemd-tmpfiles --create mysql.conf
-  fi
 }
 
 post_upgrade(){
-  getent group mysql >/dev/null 2>&1 || groupadd -g 89 mysql &>/dev/null
-  getent passwd mysql >/dev/null 2>&1 || useradd -u 89 -g mysql -d /var/lib/mysql \
-    -s /bin/false mysql &>/dev/null
+  if hash systemd-sysusers &> /dev/null; then
+    systemd-sysusers mariadb.conf
+  fi
 
+  if hash systemd-tmpfiles &> /dev/null; then
+    systemd-tmpfiles --create mariadb.conf
+  fi
+
   if [[ "$(vercmp $2 5.5.25-4)" -lt 0 ]] && [[ -d /data ]]; then
     for x in data/*; do
       cp -r $x var/lib/mysql

Deleted: mariadb.service
===================================================================
--- mariadb.service	2016-06-30 10:34:33 UTC (rev 270808)
+++ mariadb.service	2016-06-30 12:36:44 UTC (rev 270809)
@@ -1,16 +0,0 @@
-[Unit]
-Description=MariaDB database server
-After=syslog.target
-
-[Service]
-User=mysql
-Group=mysql
-
-ExecStart=/usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid 
-ExecStartPost=/usr/bin/mysqld-post
-
-Restart=always
-PrivateTmp=true
-
-[Install]
-WantedBy=multi-user.target



More information about the arch-commits mailing list