diff options
Diffstat (limited to 'abs')
-rw-r--r-- | abs/core/mysql/PKGBUILD | 9 | ||||
-rw-r--r-- | abs/core/mysql/__changelog | 3 | ||||
-rw-r--r-- | abs/core/mysql/mysql.install | 7 | ||||
-rwxr-xr-x | abs/core/mysql/mysqld.rc | 77 |
4 files changed, 90 insertions, 6 deletions
diff --git a/abs/core/mysql/PKGBUILD b/abs/core/mysql/PKGBUILD index af83d84..0c6747e 100644 --- a/abs/core/mysql/PKGBUILD +++ b/abs/core/mysql/PKGBUILD @@ -5,8 +5,8 @@ pkgname=('mysql' 'libmysqlclient' 'mysql-clients') pkgbase=mysql -pkgver=5.6.22 -pkgrel=1 +pkgver=5.6.23 +pkgrel=3 pkgdesc="Fast SQL database server, community edition" arch=('i686' 'x86_64') makedepends=('openssl' 'zlib' 'cmake' 'systemd-tools' 'libaio' 'jemalloc') @@ -18,6 +18,7 @@ source=("https://dev.mysql.com/get/Downloads/MySQL-5.6/${pkgbase}-${pkgver}.tar. "mysqld-tmpfile.conf" "mysqld.service" "my.cnf" + "mysqld.rc" "mysql-srv_buf_size.patch") prepare() { @@ -129,6 +130,7 @@ package_mysql(){ make DESTDIR="${pkgdir}" install install -m 644 -D "${srcdir}/my.cnf" "${pkgdir}/etc/mysql/my.cnf" + install -m 755 -D "${srcdir}"/mysqld.rc "${pkgdir}"/etc/rc.d/mysqld install -m 755 -D "${srcdir}/mysqld-post.sh" "${pkgdir}/usr/bin/mysqld-post" install -m 644 -D "${srcdir}/mysqld-tmpfile.conf" "${pkgdir}/usr/lib/tmpfiles.d/mysqld.conf" install -m 755 -d "${pkgdir}/usr/lib/systemd/system" @@ -167,9 +169,10 @@ package_mysql(){ rm "${pkgdir}/usr/share/man/man1/mysql-test-run.pl.1" } -md5sums=('3985b634294482363f3d87e0d67f2262' +md5sums=('60344f26eae136a267a0277407926e79' 'b79e65a5aa536e6b5bc60988eb0b78a2' '2fa6e456964d4ff5e6d4f9ff0126aed6' '81b62df0f569935109c1b107dfe9f9fa' '75121ffbbd47367c27ae0448f6282b57' + 'e7eb2faeab755cbb2fe03542bf328da9' 'f2b34ac2954bb56c4abf08c66a7f840e') diff --git a/abs/core/mysql/__changelog b/abs/core/mysql/__changelog index a0e903b..3c060d4 100644 --- a/abs/core/mysql/__changelog +++ b/abs/core/mysql/__changelog @@ -1,3 +1,6 @@ PKGBUILD: copy my.cnf to /etc/mysql/ my.cnf: data dir /data/srv/mysql my.cnf: removed binary logging +mysqld.rc: this is needed for installing db in chroot +mysql.install: change default datadir to /data/srv/mysql +mysql.install: run mysql_install_db even if datadir already exists; needed for install diff --git a/abs/core/mysql/mysql.install b/abs/core/mysql/mysql.install index f420406..586fead 100644 --- a/abs/core/mysql/mysql.install +++ b/abs/core/mysql/mysql.install @@ -1,7 +1,7 @@ if [[ $(command -v my_print_defaults >/dev/null 2>&1) ]]; then datadir=$(my_print_defaults mysqld | sed -n "s/^--datadir=//p") fi -[[ -z $datadir ]] && datadir=/var/lib/mysql +[[ -z $datadir ]] && datadir=/data/srv/mysql post_install(){ groupadd -g 89 mysql &>/dev/null @@ -9,10 +9,11 @@ post_install(){ if [[ ! -e $datadir ]]; then install -dm700 $datadir - usr/bin/mysql_install_db --user=mysql --basedir=/usr --datadir=$datadir - chown -R mysql:mysql var/lib/mysql &>/dev/null fi + usr/bin/mysql_install_db --user=mysql --basedir=/usr --datadir=$datadir + chown -R mysql:mysql var/lib/mysql &>/dev/null + usr/bin/systemd-tmpfiles --create mysqld.conf } diff --git a/abs/core/mysql/mysqld.rc b/abs/core/mysql/mysqld.rc new file mode 100755 index 0000000..4bbddb5 --- /dev/null +++ b/abs/core/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 |