From ca9bd22c5a75e0bf73bb4fcd86713c78d00e77fe Mon Sep 17 00:00:00 2001 From: Dan Theisen Date: Wed, 3 Jul 2019 06:01:32 +0000 Subject: user/ccache: new package --- user/ccache/APKBUILD | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 user/ccache/APKBUILD diff --git a/user/ccache/APKBUILD b/user/ccache/APKBUILD new file mode 100644 index 000000000..52cf944e4 --- /dev/null +++ b/user/ccache/APKBUILD @@ -0,0 +1,49 @@ +# Contributor: Sören Tempel +# Contributor: Natanael Copa +# Maintainer: Dan Theisen +pkgname=ccache +pkgver=3.7.1 +pkgrel=0 +pkgdesc="A fast C/C++ compiler cache" +url="https://ccache.dev/" +arch="all" +license="GPL-3.0+" +makedepends="zlib-dev" +checkdepends="bash perl" +subpackages="$pkgname-doc" +source="https://github.com/ccache/ccache/releases/download/v$pkgver/$pkgname-$pkgver.tar.bz2" + +prepare() { + default_prepare + update_config_sub +} + +build() { + ./configure \ + --build=$CBUILD \ + --host=$CHOST \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var + make +} + +check() { + make test +} + +package() { + install -Dm 755 ccache "$pkgdir"/usr/bin/ccache + install -Dm 644 doc/ccache.1 "$pkgdir"/usr/share/man/man1/ccache.1 + + local link= + mkdir -p "$pkgdir"/usr/lib/ccache/bin + + for link in cc gcc g++ cpp c++ ${CHOST}-cc ${CHOST}-gcc \ + ${CHOST}-g++ ${CHOST}-cpp ${CHOST}-c++; do + ln -sf /usr/bin/ccache "$pkgdir"/usr/lib/ccache/bin/$link + done +} + +sha512sums="68a716a91519020c1cd7efe07a36a7d8c040a8f26f627341e74fb6dffbf985389f949dad0b2cc35a78b37f5efdf1c112ccb3d23d8f379210c9adbaba6064763b ccache-3.7.1.tar.bz2" -- cgit v1.2.3-70-g09d2 From 38a0fdf20fdbc5142113e969cceee302f48a585d Mon Sep 17 00:00:00 2001 From: Dan Theisen Date: Wed, 3 Jul 2019 06:02:00 +0000 Subject: user/numactl: new package --- user/numactl/APKBUILD | 47 +++++++++++++++++++++++++++++++++++++++++++++++ user/numactl/musl.patch | 21 +++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 user/numactl/APKBUILD create mode 100644 user/numactl/musl.patch diff --git a/user/numactl/APKBUILD b/user/numactl/APKBUILD new file mode 100644 index 000000000..a6122fcc5 --- /dev/null +++ b/user/numactl/APKBUILD @@ -0,0 +1,47 @@ +# Contributor: Daniel Sabogal +# Maintainer: Dan Theisen +pkgname=numactl +pkgver=2.0.12 +pkgrel=0 +pkgdesc="Simple NUMA policy support" +url="https://github.com/numactl/numactl" +# ARM lacks the __NR_migrate_pages syscall +arch="all !armhf !armv7" +license="GPL-2.0+ AND LGPL-2.1" +makedepends="autoconf automake libtool linux-headers" +subpackages="$pkgname-dev $pkgname-doc $pkgname-tools" +source="$pkgname-$pkgver.tar.gz::https://github.com/numactl/$pkgname/archive/v$pkgver.tar.gz + musl.patch" + +prepare() { + default_prepare + ./autogen.sh +} + +build() { + ./configure \ + --prefix=/usr \ + --mandir=/usr/share/man + make +} + +check() { + make check VERBOSE=1 TESTS='test/distance test/nodemap test/tbitmap' +} + +package() { + make DESTDIR="$pkgdir" install + + # provided by linux man-pages + rm -r "$pkgdir"/usr/share/man/man2 +} + +tools() { + pkgdesc="NUMA policy control tools" + + mkdir -p "$subpkgdir"/usr + mv "$pkgdir"/usr/bin "$subpkgdir"/usr +} + +sha512sums="3814efd924d1c9152a30f6ae5b665afc20648226cd475d72b933c0ec4f30249af4e25110de17f144734b787ed765644dca09a657219806ab5c9c550abd45bf8e numactl-2.0.12.tar.gz +c24affa5a8a8ea83d7f0ee384dc0629e17a5c4201357132f770f894ad4236772116d96d8389d54fb99095af40d1ccbffc3170b5fb9cc88cfca39179f50bee9c9 musl.patch" diff --git a/user/numactl/musl.patch b/user/numactl/musl.patch new file mode 100644 index 000000000..009233f63 --- /dev/null +++ b/user/numactl/musl.patch @@ -0,0 +1,21 @@ +--- numactl-2.0.11/syscall.c.orig ++++ numactl-2.0.11/syscall.c +@@ -115,14 +115,16 @@ + + #endif + +-#if defined(__GLIBC__) && __GLIBC_PREREQ(2, 11) ++#if defined(__GLIBC__) ++# if __GLIBC_PREREQ(2,11) + + /* glibc 2.11 seems to have working 6 argument sycall. Use the + glibc supplied syscall in this case. + The version cut-off is rather arbitary and could be probably + earlier. */ + +-#define syscall6 syscall ++# define syscall6 syscall ++#endif + #elif defined(__x86_64__) + /* 6 argument calls on x86-64 are often buggy in both glibc and + asm/unistd.h. Add a working version here. */ -- cgit v1.2.3-70-g09d2 From c50636433139f26543aad061d54c3708b2a4e22a Mon Sep 17 00:00:00 2001 From: Dan Theisen Date: Wed, 3 Jul 2019 15:49:03 +0000 Subject: user/mariadb: new package --- experimental/mariadb/APKBUILD | 110 -------------- experimental/mariadb/mariadb.initd | 40 ----- experimental/mariadb/mariadb.pre-install | 4 - user/mariadb/APKBUILD | 249 +++++++++++++++++++++++++++++++ user/mariadb/mariadb-server.limits | 3 + user/mariadb/mariadb-server.pre-install | 7 + user/mariadb/mariadb.initd | 47 ++++++ 7 files changed, 306 insertions(+), 154 deletions(-) delete mode 100644 experimental/mariadb/APKBUILD delete mode 100644 experimental/mariadb/mariadb.initd delete mode 100644 experimental/mariadb/mariadb.pre-install create mode 100644 user/mariadb/APKBUILD create mode 100644 user/mariadb/mariadb-server.limits create mode 100644 user/mariadb/mariadb-server.pre-install create mode 100644 user/mariadb/mariadb.initd diff --git a/experimental/mariadb/APKBUILD b/experimental/mariadb/APKBUILD deleted file mode 100644 index a99de6b25..000000000 --- a/experimental/mariadb/APKBUILD +++ /dev/null @@ -1,110 +0,0 @@ -# Contributor: A. Wilcox -# Maintainer: A. Wilcox -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 deleted file mode 100644 index 143ca8ff5..000000000 --- a/experimental/mariadb/mariadb.initd +++ /dev/null @@ -1,40 +0,0 @@ -#!/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 deleted file mode 100644 index ec71275ca..000000000 --- a/experimental/mariadb/mariadb.pre-install +++ /dev/null @@ -1,4 +0,0 @@ -#!/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 diff --git a/user/mariadb/APKBUILD b/user/mariadb/APKBUILD new file mode 100644 index 000000000..e5e9c2f83 --- /dev/null +++ b/user/mariadb/APKBUILD @@ -0,0 +1,249 @@ +# Contributor: A. Wilcox +# Contributor: Dan Theisen +# Maintainer: Dan Theisen +pkgname=mariadb +pkgver=10.4.6 +pkgrel=0 +pkgdesc="Open source database server" +url="https://mariadb.org/" +arch="all" +license="GPL-2.0-only" +pkgusers="mysql" +pkggroups="mysql" +depends="$pkgname-common" +depends_dev="openssl-dev zlib-dev" +makedepends="$depends_dev bison cmake curl-dev libaio-dev libarchive-dev + libedit-dev libevent-dev libexecinfo-dev libxml2-dev numactl-dev + ncurses-dev linux-pam-dev pcre-dev xz-dev" +_mytopdeps="perl perl-dbi perl-dbd-mysql perl-getopt-long perl-socket + perl-term-readkey" +subpackages="$pkgname-client $pkgname-server $pkgname-libs $pkgname-embedded + $pkgname-common::noarch $pkgname-backup mytop::noarch $pkgname-openrc + $pkgname-doc $pkgname-dev" +source="https://downloads.mariadb.org/interstitial/mariadb-$pkgver/source/mariadb-$pkgver.tar.gz + mariadb.initd + mariadb-server.limits + " + +options="suid" # required for pam_auth plugin, which is needed for + # mysql_install_db to work + +build() { + if [ "$CBUILD" != "$CHOST" ]; then + CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux" + fi + + local _release="\ + -DBUILD_CONFIG=mysql_release \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS=\"$CXXFLAGS -DNDEBUG\" \ + -DCMAKE_C_FLAGS=\"$CFLAGS -DNDEBUG\" \ + -DWITH_DEFAULT_COMPILER_OPTIONS=NO \ + -DWITH_DEFAULT_FEATURE_SET=NO " + + # NUMA is disabled because all arches do not support it + # SKIP_TESTS skips client unittests that require a server to be present + # JEMALLOC is reported to not work on musl, TODO: test this + # ASAN also doesn't work on musl iirc + local _deps="\ + -DWITH_MARIABACKUP=ON \ + -DWITH_NUMA=OFF \ + -DWITH_LIBNUMA=OFF \ + -DWITH_LIBWSREP=ON \ + -DWITH_UNIT_TESTS=ON \ + -DWITH_LIBEDIT=ON \ + -DWITH_EMBEDDED_SERVER=ON \ + -DWITH_UNITTEST=OFF \ + -DWITH_ASAN=OFF \ + -DWITH_JEMALLOC=OFF \ + -DWITH_LIBWRAP=OFF \ + -DWITH_SYSTEMD=no \ + -DWITH_VALGRIND=OFF \ + -DWITH_COMMENT=\"${DISTRO_NAME:-Adélie Linux}\" \ + -DENABLED_LOCAL_INFILE=ON \ + -DENABLED_PROFILING=OFF \ + -DSKIP_TESTS=ON " + + # AWS_KEY_MANAGEMENT makes this package non-redistributable, disable it + local _plugins="\ + -DPLUGIN_ARCHIVE=YES \ + -DPLUGIN_ARIA=YES \ + -DPLUGIN_BLACKHOLE=YES \ + -DPLUGIN_CSV=YES \ + -DPLUGIN_MYISAM=YES \ + -DAUTH_GSSAPI_PLUGIN_TYPE=NO \ + -DPLUGIN_AUTH_GSSAPI=NO \ + -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ + -DPLUGIN_CASSANDRA=NO \ + -DPLUGIN_FEEDBACK=NO " + + # Investigate turning more of these on + local _innodb="\ + -DWITH_INNODB_LZMA=YES \ + -DWITH_INNODB_BZIP2=NO \ + -DWITH_INNODB_LZ4=NO \ + -DWITH_INNODB_LZO=NO \ + -DWITH_INNODB_SNAPPY=NO " + + # MongoDB is not libre software, disable it + local _connect="\ + -DCONNECT_WITH_MYSQL=YES \ + -DCONNECT_WITH_MONGO=NO \ + -DCONNECT_WITH_ODBC=NO \ + -DCONNECT_WITH_JDBC=NO \ + -DCONNECT_WITH_LIBXML2=system " + + local _system_libs="\ + -DWITH_LIBARCHIVE=system \ + -DWITH_PCRE=system \ + -DWITH_SSL=system \ + -DWITH_ZLIB=system \ + -DWITH_EXTERNAL_ZLIB=YES \ + -DCONC_WITH_EXTERNAL_ZLIB=YES " + + local _system_paths="\ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DSYSCONFDIR=/etc/mysql \ + -DMYSQL_DATADIR=/var/lib/mariadb \ + -DMYSQL_UNIX_ADDR=/var/run/mariadb/mysqld.sock \ + -DINSTALL_UNIX_ADDRDIR=/var/run/mariadb/mysqld.sock \ + -DPKG_CONFIG_EXECUTABLE=/usr/bin/pkgconf \ + -DINSTALL_BINDIR=bin \ + -DINSTALL_SCRIPTDIR=bin \ + -DINSTALL_SBINDIR=sbin \ + -DINSTALL_INCLUDEDIR=include/mysql \ + -DINSTALL_LIBDIR=lib \ + -DINSTALL_PLUGINDIR=lib/mariadb/plugin \ + -DINSTALL_DOCDIR=share/doc/$pkgname \ + -DINSTALL_DOCREADMEDIR=share/doc/$pkgname \ + -DINSTALL_MANDIR=share/man \ + -DINSTALL_MYSQLSHAREDIR=share/mariadb \ + -DINSTALL_SUPPORTFILESDIR=share/mariadb \ + -DSUFFIX_INSTALL_DIR=\"\" " + + _buildflags=$(echo "\ + ${_release}\ + ${_deps}\ + ${_plugins}\ + ${_innodb}\ + ${_connect}\ + ${_system_libs}\ + ${_system_paths}\ + ${CMAKE_CROSSOPTS}" | tr -d '\t') + echo "Build Flags are: $_buildflags" + eval "cmake $_buildflags" + make +} + +check() { + CTEST_OUTPUT_ON_FAILURE=TRUE ctest -E '^(test-connect)$' +} + +package() { + depends="$pkgname-client $pkgname-server" + install -m755 -D ${srcdir}/mariadb.initd ${pkgdir}/etc/init.d/mariadb +} + +openrc() { + default_openrc + depends="mariadb-server=$pkgver-r$pkgrel" +} + +_install_component() { + cd "$builddir" + component=$1 + prefix=$subpkgdir/usr + msg "Installing component \"$component\" into $prefix" + cmake -DCMAKE_INSTALL_PREFIX=${prefix} \ + -DCOMPONENT=${component} \ + -P cmake_install.cmake +} + +libs() { + pkgdesc="Libraries for the MariaDB database" + _install_component SharedLibraries +} + +client() { + pkgdesc="The MariaDB database client" + depends="mariadb-common=$pkgver-r$pkgrel" + for part in Client ClientPlugins; do + _install_component ${part} + done +} + +server() { + pkgdesc="The MariaDB database server" + depends="mariadb-common=$pkgver-r$pkgrel" + install="$pkgname-server.pre-install" + for part in Server Server_Scripts IniFiles connect-engine; do + _install_component ${part} + done + + install -m755 -D ${srcdir}/mariadb-server.limits \ + ${subpkgdir}/etc/security/limits.d/mariadb.conf +} + + +common() { + pkgdesc="MariaDB common files for both server and client" + replaces="mysql-common" + depends= + + SHARE_PATH=${pkgdir}-server/usr/share + mkdir -p ${subpkgdir}/usr + mv $SHARE_PATH ${subpkgdir}/usr + + _install_component Common +} + +embedded() { + pkgdesc="MariaDB embedded server and embeddable library" + + # move mysql-embedded from client subpackage to embedded + mkdir -p ${subpkgdir}/usr/bin + BIN_PATH=${pkgdir}-client/usr/bin + mv $BIN_PATH/mysql_embedded ${subpkgdir}/usr/bin/ + + # move embedded mysqld libraries from server package to embedded + mkdir -p ${subpkgdir}/usr/lib + LIB_PATH=${pkgdir}-server/usr/lib + MYSQLD_ELIB=$(readlink $LIB_PATH/libmysqld.so) + mv $LIB_PATH/$MYSQLD_ELIB ${subpkgdir}/usr/lib/ + mv $LIB_PATH/libmysqld.so ${subpkgdir}/usr/lib/ + mv $LIB_PATH/libmariadbd.so ${subpkgdir}/usr/lib/ +} + +backup() { + pkgdesc="The mariabackup tool for physical online backups" + _install_component backup +} + +mytop() { + pkgdesc="Command line tool used for monitoring MariaDB performance" + depends="$_mytopdeps" + _install_component Mytop +} + +dev() { + replaces="libmysqlclient mysql-dev" + provides="mysql-dev=$pkgver-r$pkgrel" + depends="$pkgname-libs" + _install_component Development + + # move symlinks for static libs from libs subpackage to dev + LIB_PATH=${pkgdir}-libs/usr/lib + mv $LIB_PATH/libmysqlclient.a ${subpkgdir}/usr/lib/ + mv $LIB_PATH/libmysqlclient_r.a ${subpkgdir}/usr/lib/ +} + +doc() { + for part in ManPagesClient ManPagesServer ManPagesDevelopment; do + _install_component ${part} + done + default_doc +} + +sha512sums="b04c47f72de2473d7b5edd04b4785a1d7179bb1f429f30ba53ae6cfbbb413200d9803eff1072949b2e81fd7d2164ea34c68620d621d4181b913daa2293ae140c mariadb-10.4.6.tar.gz +1a2b058aad5fd6d6964db58b663591299a5bf82e7ad21a105d53a3e7ad1c3674c737caf3ee12799cce947cf8ead1f3e789dd8afcfc769891f08208b3006f9654 mariadb.initd +d47324b34a87410eddb554f65199d145dfba9ae40407a62fb77df4e1ebf13087d15eb28e61e5e7cc9139eb42f093a0955136edae4020822652a1f0b4e219849e mariadb-server.limits" diff --git a/user/mariadb/mariadb-server.limits b/user/mariadb/mariadb-server.limits new file mode 100644 index 000000000..520783992 --- /dev/null +++ b/user/mariadb/mariadb-server.limits @@ -0,0 +1,3 @@ +# +@mysql soft nofile 65535 +@mysql hard nofile 65535 diff --git a/user/mariadb/mariadb-server.pre-install b/user/mariadb/mariadb-server.pre-install new file mode 100644 index 000000000..de2bcd795 --- /dev/null +++ b/user/mariadb/mariadb-server.pre-install @@ -0,0 +1,7 @@ +#!/bin/sh + +groupadd -g 60 -r mysql +useradd -M -N -r -u 60 -g 60 -c "MariaDB Database User" -d /var/lib/mysql -s /sbin/nologin mysql + +mkdir /var/lib/mysql +chown mysql:mysql /var/lib/mysql diff --git a/user/mariadb/mariadb.initd b/user/mariadb/mariadb.initd new file mode 100644 index 000000000..4e1cf8d3e --- /dev/null +++ b/user/mariadb/mariadb.initd @@ -0,0 +1,47 @@ +#!/sbin/openrc-run + +getconf() { + v=$(my_print_defaults --mysqld | grep ^--$1) + [ -z $v ] && echo $2 || echo ${v#*=} +} + +retry="60" +extra_stopped_commands="setup" + +user=${MYSQLD_USER:-mysql} +group=${MYSQLD_GROUP:-mysql} +default_datadir=$(getconf datadir "/var/lib/mariadb") +datadir=${MYSQLD_DATADIR:-$default_datadir} + +command="/usr/bin/mysqld_safe" +command_args="--syslog --nowatch --user=$user" + +depend() { + use net + need localmount +} + +setup() { + checkpath -d -m 1775 -o $user:$group /run/mariadb + ebegin "Creating a new MySQL database in $datadir" + mysql_install_db --user=$user --datadir=$datadir + eend $? +} + +start_pre() { + pidfile=$(getconf pid-file "/run/mariadb/mysqld.pid") + command_args="$command_args --pid-file=$pidfile" + if [ ! -d $datadir/mysql ]; then + eerror "Data directory '$datadir' is empty or invalid." + eerror "Run '/etc/init.d/mariadb setup' to create new database." + fi +} + +start_post() { + ewaitfile 10 $(getconf socket "/run/mariadb/mysqld.sock") +} + +stop_pre() { + pidfile=$(getconf pid-file "/run/mariadb/mysqld.pid") +} + -- cgit v1.2.3-70-g09d2