diff options
author | root <root@rshg054.dnsready.net> | 2012-08-21 00:02:33 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2012-08-21 00:02:33 +0000 |
commit | a3669c04838b48b6891b2ffc4b296fa515f8174f (patch) | |
tree | fb838dbf7e59e2f79d7fca0fce6d93c254a5c173 /extra/mysql | |
parent | 524da814660fa35bca4a24d0faa0a10b7eab5c6f (diff) |
Tue Aug 21 00:02:33 UTC 2012
Diffstat (limited to 'extra/mysql')
-rw-r--r-- | extra/mysql/PKGBUILD | 35 | ||||
-rw-r--r-- | extra/mysql/mysql.install | 2 | ||||
-rwxr-xr-x | extra/mysql/mysqld-post.sh | 7 | ||||
-rw-r--r-- | extra/mysql/mysqld-tmpfile.conf | 1 | ||||
-rwxr-xr-x | extra/mysql/mysqld.rc | 77 | ||||
-rw-r--r-- | extra/mysql/mysqld.service | 11 |
6 files changed, 117 insertions, 16 deletions
diff --git a/extra/mysql/PKGBUILD b/extra/mysql/PKGBUILD index c7be9147d..973985940 100644 --- a/extra/mysql/PKGBUILD +++ b/extra/mysql/PKGBUILD @@ -1,26 +1,26 @@ -# $Id: PKGBUILD 164697 2012-08-03 07:57:29Z andrea $ -# Maintainer: -# Contributor: Andrea Scarpino <andrea@archlinux.org> +# $Id: PKGBUILD 165439 2012-08-19 15:29:10Z andrea $ +# Maintainer: Andrea Scarpino <andrea@archlinux.org> # Contributor: Douglas Soares de Andrade <douglas@archlinux.org> pkgbase=mysql pkgname=('libmysqlclient' 'mysql-clients' 'mysql') pkgver=5.5.27 -pkgrel=1 +pkgrel=3 arch=('i686' 'x86_64') license=('GPL') url="https://www.mysql.com/products/community/" makedepends=('cmake' 'openssl' 'zlib') options=('!libtool') source=("http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-5.5/${pkgbase}-${pkgver}.tar.gz" - 'mysqld' - 'my.cnf') + 'mysqld.rc' 'my.cnf' 'mysqld-post.sh' 'mysqld-tmpfile.conf' 'mysqld.service') md5sums=('82baf46acfced6eef072e9d8a479c86e' - '2234207625baa29b2ff7d7b4f088abce' - '1c949c0dbea5206af0db14942d9927b6') + 'e7eb2faeab755cbb2fe03542bf328da9' + '1c949c0dbea5206af0db14942d9927b6' + '6ea6ceb360d09a774e87335ee098ddd5' + '2fa6e456964d4ff5e6d4f9ff0126aed6' + 'a0e1460c276a50a9666c331de83271f2') build() { - cd "${srcdir}" mkdir build cd build @@ -31,7 +31,7 @@ build() { -DCMAKE_INSTALL_PREFIX=/usr \ -DSYSCONFDIR=/etc/mysql \ -DMYSQL_DATADIR=/var/lib/mysql \ - -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \ + -DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DENABLED_LOCAL_INFILE=ON \ @@ -68,7 +68,7 @@ package_libmysqlclient(){ pkgdesc="MySQL client libraries" depends=('openssl') - cd "${srcdir}"/build + cd build for dir in include libmysql libmysqld libservices; do make -C ${dir} DESTDIR="${pkgdir}" install done @@ -85,7 +85,7 @@ package_mysql-clients(){ pkgdesc="MySQL client tools" depends=('libmysqlclient') - cd "${srcdir}"/build + cd build make -C client DESTDIR="${pkgdir}" install # install man pages @@ -102,15 +102,18 @@ package_mysql(){ pkgdesc="A fast SQL database server" backup=('etc/mysql/my.cnf') install=mysql.install - depends=('mysql-clients') - optdepends=('perl-dbi' 'perl-dbd-mysql') + depends=('mysql-clients' 'systemd-tools') options=('emptydirs') - cd "${srcdir}"/build + cd build make DESTDIR="${pkgdir}" install install -Dm644 "${srcdir}"/my.cnf "${pkgdir}"/etc/mysql/my.cnf - install -Dm755 "${srcdir}"/mysqld "${pkgdir}"/etc/rc.d/mysqld + install -Dm755 "${srcdir}"/mysqld.rc "${pkgdir}"/etc/rc.d/mysqld + install -Dm755 "${srcdir}"/mysqld-post.sh "${pkgdir}"/usr/bin/mysqld-post + install -Dm644 "${srcdir}"/mysqld-tmpfile.conf "${pkgdir}"/usr/lib/tmpfiles.d/mysqld.conf + install -d "${pkgdir}"/usr/lib/systemd/system + install -Dm644 "${srcdir}"/mysqld.service "${pkgdir}"/usr/lib/systemd/system/ # provided by libmysqlclient rm "${pkgdir}"/usr/bin/{mysql_config,mysql_client_test_embedded,mysqltest_embedded} diff --git a/extra/mysql/mysql.install b/extra/mysql/mysql.install index 9a4479215..a98f1a877 100644 --- a/extra/mysql/mysql.install +++ b/extra/mysql/mysql.install @@ -3,6 +3,8 @@ post_install(){ useradd -u 89 -g mysql -d /var/lib/mysql -s /bin/false mysql &>/dev/null usr/bin/mysql_install_db --user=mysql --basedir=/usr chown -R mysql:mysql var/lib/mysql &>/dev/null + + usr/bin/systemd-tmpfiles --create mysqld.conf } post_upgrade(){ diff --git a/extra/mysql/mysqld-post.sh b/extra/mysql/mysqld-post.sh new file mode 100755 index 000000000..8dc9c4eea --- /dev/null +++ b/extra/mysql/mysqld-post.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +while true; do + response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break + echo "$response" | grep -q "mysqld is alive" && break + sleep 1 +done diff --git a/extra/mysql/mysqld-tmpfile.conf b/extra/mysql/mysqld-tmpfile.conf new file mode 100644 index 000000000..6883dc798 --- /dev/null +++ b/extra/mysql/mysqld-tmpfile.conf @@ -0,0 +1 @@ +d /run/mysqld 0755 mysql mysql - diff --git a/extra/mysql/mysqld.rc b/extra/mysql/mysqld.rc new file mode 100755 index 000000000..4bbddb5a4 --- /dev/null +++ b/extra/mysql/mysqld.rc @@ -0,0 +1,77 @@ +#!/bin/bash + +# general config +. /etc/rc.conf +. /etc/rc.d/functions + +getPID() { + echo $(pgrep -u mysql mysqld 2>/dev/null); +} + +case "$1" in + start) + stat_busy "Starting MySQL Server" + [ ! -d /run/mysqld ] && install -d -g mysql -o mysql /run/mysqld &>/dev/null + if [ -z "$(getPID)" ]; then + /usr/bin/mysqld_safe --user=mysql &>/dev/null & + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + timeo=30 + while [ $timeo -gt 0 ]; do + response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break + echo "$response" | grep -q "mysqld is alive" && break + sleep 1 + let timeo=${timeo}-1 + done + if [ $timeo -eq 0 ]; then + stat_fail + exit 1 + else + echo $(getPID) > /run/mysqld/mysqld.pid + add_daemon mysqld + stat_done + fi + fi + else + stat_fail + exit 1 + fi + ;; + + stop) + stat_busy "Stopping MySQL Server" + if [ ! -z "$(getPID)" ]; then + timeo=30 + kill $(getPID) &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + fi + while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do + sleep 1 + let timeo=${timeo}-1 + done + if [ -z "$(getPID)" ]; then + rm -f /run/mysqld/mysqld.pid &>/dev/null + rm_daemon mysqld + stat_done + else + stat_fail + exit 1 + fi + else + stat_fail + exit 1 + fi + ;; + + restart) + $0 stop + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/extra/mysql/mysqld.service b/extra/mysql/mysqld.service new file mode 100644 index 000000000..0175c685b --- /dev/null +++ b/extra/mysql/mysqld.service @@ -0,0 +1,11 @@ +[Unit] +Description=MySQL Server + +[Service] +User=mysql +ExecStart=/usr/bin/mysqld --user=mysql +ExecStartPost=/usr/bin/mysqld-post +Restart=always + +[Install] +WantedBy=multi-user.target |