From 19b6bb3093864849a208b0e423511f5c9c7747a1 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Thu, 14 Feb 2019 12:33:26 +0000
Subject: experimental/mariadb: ugly pos

---
 experimental/mariadb/APKBUILD            | 110 +++++++++++++++++++++++++++++++
 experimental/mariadb/mariadb.initd       |  40 +++++++++++
 experimental/mariadb/mariadb.pre-install |   4 ++
 3 files changed, 154 insertions(+)
 create mode 100644 experimental/mariadb/APKBUILD
 create mode 100644 experimental/mariadb/mariadb.initd
 create mode 100644 experimental/mariadb/mariadb.pre-install

(limited to 'experimental')

diff --git a/experimental/mariadb/APKBUILD b/experimental/mariadb/APKBUILD
new file mode 100644
index 000000000..a99de6b25
--- /dev/null
+++ b/experimental/mariadb/APKBUILD
@@ -0,0 +1,110 @@
+# Contributor: A. Wilcox <awilfox@adelielinux.org>
+# Maintainer: A. Wilcox <awilfox@adelielinux.org>
+pkgname=mariadb
+pkgver=10.3.12
+pkgrel=0
+pkgdesc="Open source database server"
+url="https://mariadb.org/"
+arch="all"
+options="!checkroot"  # Tests must be run as normal user.
+license="GPL-2.0-only"
+pkgusers="mysql"
+pkggroups="mysql"
+depends="$pkgname-common"
+depends_dev="openssl-dev zlib-dev"
+makedepends="$depends_dev byacc cmake curl-dev libarchive-dev libedit-dev
+	libevent-dev libxml2-dev ncurses-dev pcre-dev xz-dev"
+install="$pkgname.pre-install"
+subpackages="$pkgname-doc $pkgname-openrc"
+source="https://downloads.mariadb.org/interstitial/mariadb-$pkgver/source/mariadb-$pkgver.tar.gz
+	mariadb.initd
+	"
+
+build() {
+	cd "$builddir"
+	if [ "$CBUILD" != "$CHOST" ]; then
+		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
+	fi
+	cmake \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_BUILD_TYPE=Release \
+		-DCMAKE_CXX_FLAGS="$CXXFLAGS -DNDEBUG" \
+		-DCMAKE_C_FLAGS="$CFLAGS -DNDEBUG" \
+		-DMYSQL_DATADIR="/var/lib/mysql" \
+		-DSYSCONFDIR="/etc/mysql" \
+		-DINSTALL_BINDIR=bin \
+		-DINSTALL_DOCDIR=share/doc/$pkgname-$pkgver \
+		-DINSTALL_DOCREADMEDIR=share/doc/$pkgname-$pkgver \
+		-DINSTALL_INCLUDEDIR=include/mysql \
+		-DINSTALL_LIBDIR=lib \
+		-DINSTALL_MANDIR=share/man \
+		-DINSTALL_MYSQLSHAREDIR=share/mariadb \
+		-DINSTALL_PLUGINDIR=lib/mariadb/plugin \
+		-DINSTALL_SCRIPTDIR=share/mariadb/scripts \
+		-DINSTALL_MYSQLDATADIR="/var/lib/mysql" \
+		-DINSTALL_SBINDIR=sbin \
+		-DINSTALL_SUPPORTFILESDIR="/usr/share/mariadb" \
+		-DWITH_COMMENT="${DISTRO_NAME:-Adélie Linux}" \
+		-DWITH_UNIT_TESTS=ON \
+		-DWITH_LIBEDIT=1 \
+		-DWITH_ZLIB=system \
+		-DWITHOUT_LIBWRAP=1 \
+		-DENABLED_LOCAL_INFILE=1 \
+		-DMYSQL_UNIX_ADDR="/var/run/mysqld/mysqld.sock" \
+		-DINSTALL_UNIX_ADDRDIR="/var/run/mysqld/mysqld.sock" \
+		-DWITH_DEFAULT_COMPILER_OPTIONS=0 \
+		-DWITH_DEFAULT_FEATURE_SET=0 \
+		-DPKG_CONFIG_EXECUTABLE="/usr/bin/pkgconf" \
+		-DPLUGIN_AUTH_GSSAPI=NO \
+		-DAUTH_GSSAPI_PLUGIN_TYPE=OFF \
+		-DCONC_WITH_EXTERNAL_ZLIB=YES \
+		-DWITH_EXTERNAL_ZLIB=YES \
+		-DSUFFIX_INSTALL_DIR="" \
+		-DWITH_UNITTEST=OFF \
+		-DCONNECT_WITH_MYSQL=ON \
+		-DCONNECT_WITH_LIBXML2=system \
+		-DCONNECT_WITH_ODBC=NO \
+		-DCONNECT_WITH_JDBC=NO \
+		-DPLUGIN_ARCHIVE=YES \
+		-DPLUGIN_ARIA=YES \
+		-DPLUGIN_BLACKHOLE=YES \
+		-DPLUGIN_CASSANDRA=NO \
+		-DPLUGIN_CSV=YES \
+		-DPLUGIN_MYISAM=YES \
+		-DWITH_ASAN=OFF \
+		-DWITH_EMBEDDED_SERVER=ON \
+		-DWITH_INNODB_BZIP2=OFF \
+		-DWITH_INNODB_LZ4=OFF \
+		-DWITH_INNODB_LZMA=ON \
+		-DWITH_INNODB_LZO=OFF \
+		-DWITH_INNODB_SNAPPY=OFF \
+		-DWITH_JEMALLOC=NO \
+		-DWITH_LIBARCHIVE=system \
+		-DWITH_LIBNUMA=NO \
+		-DWITH_LIBWRAP=OFF \
+		-DWITH_LIBWSEP=OFF \
+		-DWITH_MARIABACKUP=ON \
+		-DWITH_PCRE=system \
+		-DWITH_SYSTEMD=no \
+		-DWITH_SSL=system \
+		-DWITH_VALGRIND=OFF \
+		-DWITH_ZLIB=system \
+		-DSKIP_TESTS=ON
+		${CMAKE_CROSSOPTS}
+	make
+}
+
+check() {
+	cd "$builddir"
+	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
+}
+
+package() {
+	cd "$builddir"
+	make DESTDIR="$pkgdir" install
+	install -m644 -D "$srcdir"/mariadb.initd "$pkgdir"/etc/init.d/mariadb
+	rm -r "$pkgdir"/usr/mysql-test
+}
+
+sha512sums="9dd2939684c4591db306be6afb34663626dfaae133f88dd31125c759dce16b9e9d767a9254e30d9ee5fa2ea027e223dd4799effba8a8b0e4638d5de9e2512003  mariadb-10.3.12.tar.gz
+06751768cb00d2e433655635c38d267ef25084a5830ff40e719ac579223c7192dc34b43f919ab6faf480094632327511cbd22456064dde2d04dc15648b9e3b9f  mariadb.initd"
diff --git a/experimental/mariadb/mariadb.initd b/experimental/mariadb/mariadb.initd
new file mode 100644
index 000000000..143ca8ff5
--- /dev/null
+++ b/experimental/mariadb/mariadb.initd
@@ -0,0 +1,40 @@
+#!/sbin/openrc-run
+
+getconf() {
+	v=$(my_print_defaults --mysqld | grep ^--$1)
+	[ -z $v ] && echo $2 || echo ${v#*=}
+}
+
+retry="60"
+extra_stopped_commands="setup"
+command="/usr/bin/mysqld_safe"
+command_args="--syslog --nowatch"
+depend() {
+	use net
+	need localmount
+}
+
+setup() {
+	ebegin "Creating a new MySQL database"
+	mysql_install_db --user=mysql --rpm
+	eend $?
+}
+
+start_pre() {
+	pidfile=$(getconf pid-file "/run/mysqld/mysqld.pid")
+	command_args="$command_args --pid-file=$pidfile"
+	required_dirs=$(getconf datadir "/var/lib/mysql")
+	if [ ! -d $required_dirs/mysql ]; then
+		eerror "Datadir '$required_dirs' is empty or invalid."
+		eerror "Run '/etc/init.d/mariadb setup' to create new database."
+	fi
+}
+
+start_post() {
+	ewaitfile 10 $(getconf socket "/run/mysqld/mysqld.sock")
+}
+
+stop_pre() {
+	pidfile=$(getconf pid-file "/run/mysqld/mysqld.pid")
+}
+
diff --git a/experimental/mariadb/mariadb.pre-install b/experimental/mariadb/mariadb.pre-install
new file mode 100644
index 000000000..ec71275ca
--- /dev/null
+++ b/experimental/mariadb/mariadb.pre-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+groupadd -g 60 -r mysql
+useradd -u 60 -c "MariaDB Database User" -d /var/lib/mysql -M -N -G mysql -r -s /sbin/nologin mysql
-- 
cgit v1.2.3-70-g09d2