pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/databases Allow overriding mariadb_datadir in rc.conf



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3afc8fc6906e
branches:  trunk
changeset: 373113:3afc8fc6906e
user:      abs <abs%pkgsrc.org@localhost>
date:      Sun Feb 06 17:52:24 2022 +0000

description:
Allow overriding mariadb_datadir in rc.conf

Bump PKGREVISION

diffstat:

 databases/mariadb104-server/Makefile         |   4 ++--
 databases/mariadb104-server/files/mariadb.sh |  25 ++++++++++++++++---------
 databases/mariadb105-server/Makefile         |   4 ++--
 databases/mariadb105-server/files/mariadb.sh |  25 ++++++++++++++++---------
 databases/mariadb106-server/Makefile         |   4 ++--
 databases/mariadb106-server/files/mariadb.sh |  25 ++++++++++++++++---------
 6 files changed, 54 insertions(+), 33 deletions(-)

diffs (257 lines):

diff -r c46c93cba31e -r 3afc8fc6906e databases/mariadb104-server/Makefile
--- a/databases/mariadb104-server/Makefile      Sun Feb 06 17:42:57 2022 +0000
+++ b/databases/mariadb104-server/Makefile      Sun Feb 06 17:52:24 2022 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.18 2022/01/10 01:46:27 ryoon Exp $
+# $NetBSD: Makefile,v 1.19 2022/02/06 17:52:24 abs Exp $
 
 PKGNAME=       ${DISTNAME:S/-/-server-/}
-PKGREVISION=   4
+PKGREVISION=   5
 COMMENT=       MariaDB 10.4, a free MySQL compatible database (server)
 
 CONFLICTS=     mysql-server-[0-9]*
diff -r c46c93cba31e -r 3afc8fc6906e databases/mariadb104-server/files/mariadb.sh
--- a/databases/mariadb104-server/files/mariadb.sh      Sun Feb 06 17:42:57 2022 +0000
+++ b/databases/mariadb104-server/files/mariadb.sh      Sun Feb 06 17:52:24 2022 +0000
@@ -1,11 +1,14 @@
 #!/bin/sh
 #
-# $NetBSD: mariadb.sh,v 1.2 2021/05/11 17:26:50 nia Exp $
+# $NetBSD: mariadb.sh,v 1.3 2022/02/06 17:52:24 abs Exp $
 #
 # PROVIDE: mariadb mysqld
 # REQUIRE: DAEMON LOGIN mountall
 # KEYWORD: shutdown
 #
+# Optional rc.conf variables:
+#      mariadb_flags=""                   # additional mariadb startup flags
+#      mariadb_datadir="/path/to/datadir" # path to mariadb datadir
 
 if [ -f /etc/rc.subr ]
 then
@@ -14,19 +17,24 @@
 
 name="mariadb"
 rcvar=${name}
+
+load_rc_config $name
+: ${mariadb_datadir:=@MARIADB_DATADIR@}
+
 procname="@PREFIX@/sbin/mysqld"
 command="@PREFIX@/bin/mariadbd-safe"
 command_args="--pid-file=@VARBASE@/run/mariadb/mariadb.pid"
 command_args="${command_args} --user=@MARIADB_USER@"
-command_args="${command_args} --datadir=@MARIADB_DATADIR@"
-command_args="${command_args} --log-error=@VARBASE@/log/mariadb/error.log &"
+command_args="${command_args} --datadir=$mariadb_datadir"
+command_args="${command_args} --log-error=@VARBASE@/log/mariadb/error.log"
+command_args="${command_args} ${mariadb_flags} &"
 extra_commands="initdb"
 initdb_cmd="mariadb_initdb"
 start_precmd="mariadb_prestart"
 pidfile="@VARBASE@/run/mariadb/mariadb.pid"
 
 mariadb_initdb() {
-        if [ -f @MARIADB_DATADIR@/mysql/user.frm ]; then
+        if [ -f $mariadb_datadir/mysql/user.frm ]; then
                 echo "The MariaDB database has already been initialized."
                 echo "Skipping database initialization."
         else
@@ -34,20 +42,19 @@
                sh @PREFIX@/bin/mysql_install_db --force \
                        --auth-root-authentication-method=normal \
                        --user=@MARIADB_USER@ \
-                       --datadir=@MARIADB_DATADIR@
-               if [ -d @MARIADB_DATADIR@ ]; then
+                       --datadir=$mariadb_datadir
+               if [ -d $mariadb_datadir ]; then
                        /usr/sbin/chown -R @MARIADB_USER@:@MARIADB_GROUP@ \
-                               @MARIADB_DATADIR@
+                               $mariadb_datadir
                 fi
        fi
 }
 
 mariadb_prestart() {
-       if ! [ -f @MARIADB_DATADIR@/mysql/user.frm ]; then
+       if ! [ -f $mariadb_datadir/mysql/user.frm ]; then
                mariadb_initdb
        fi
        ulimit -n 4096
 }
 
-load_rc_config $name
 run_rc_command "$1"
diff -r c46c93cba31e -r 3afc8fc6906e databases/mariadb105-server/Makefile
--- a/databases/mariadb105-server/Makefile      Sun Feb 06 17:42:57 2022 +0000
+++ b/databases/mariadb105-server/Makefile      Sun Feb 06 17:52:24 2022 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.21 2022/01/10 01:46:27 ryoon Exp $
+# $NetBSD: Makefile,v 1.22 2022/02/06 17:52:24 abs Exp $
 
 PKGNAME=       ${DISTNAME:S/-/-server-/}
-PKGREVISION=   2
+PKGREVISION=   3
 COMMENT=       MariaDB 10.5, a free MySQL compatible database (server)
 
 CONFLICTS=     mysql-server-[0-9]*
diff -r c46c93cba31e -r 3afc8fc6906e databases/mariadb105-server/files/mariadb.sh
--- a/databases/mariadb105-server/files/mariadb.sh      Sun Feb 06 17:42:57 2022 +0000
+++ b/databases/mariadb105-server/files/mariadb.sh      Sun Feb 06 17:52:24 2022 +0000
@@ -1,11 +1,14 @@
 #!/bin/sh
 #
-# $NetBSD: mariadb.sh,v 1.3 2021/08/12 10:51:31 nia Exp $
+# $NetBSD: mariadb.sh,v 1.4 2022/02/06 17:52:24 abs Exp $
 #
 # PROVIDE: mariadb mysqld
 # REQUIRE: DAEMON LOGIN mountall
 # KEYWORD: shutdown
 #
+# Optional rc.conf variables:
+#      mariadb_flags=""                   # additional mariadb startup flags
+#      mariadb_datadir="/path/to/datadir" # path to mariadb datadir
 
 if [ -f /etc/rc.subr ]
 then
@@ -14,35 +17,40 @@
 
 name="mariadb"
 rcvar=${name}
+
+load_rc_config $name
+: ${mariadb_datadir:=@MARIADB_DATADIR@}
+
 procname="@PREFIX@/sbin/mariadbd"
 command="@PREFIX@/bin/mariadbd-safe"
 command_args="--pid-file=@VARBASE@/run/mariadb/mariadb.pid"
 command_args="${command_args} --user=@MARIADB_USER@"
-command_args="${command_args} --datadir=@MARIADB_DATADIR@"
-command_args="${command_args} --log-error=@VARBASE@/log/mariadb/error.log &"
+command_args="${command_args} --datadir=$mariadb_datadir"
+command_args="${command_args} --log-error=@VARBASE@/log/mariadb/error.log"
+command_args="${command_args} ${mariadb_flags} &"
 extra_commands="initdb"
 initdb_cmd="mariadb_initdb"
 start_precmd="mariadb_prestart"
 pidfile="@VARBASE@/run/mariadb/mariadb.pid"
 
 mariadb_initdb() {
-        if [ -f @MARIADB_DATADIR@/mysql/user.frm ]; then
+        if [ -f $mariadb_datadir/mysql/user.frm ]; then
                 echo "The MariaDB database has already been initialized."
                 echo "Skipping database initialization."
         else
                echo "Initializing MariaDB database system tables."
                sh @PREFIX@/bin/mysql_install_db --force \
                        --user=@MARIADB_USER@ \
-                       --datadir=@MARIADB_DATADIR@
-               if [ -d @MARIADB_DATADIR@ ]; then
+                       --datadir=$mariadb_datadir
+               if [ -d $mariadb_datadir ]; then
                        /usr/sbin/chown -R @MARIADB_USER@:@MARIADB_GROUP@ \
-                               @MARIADB_DATADIR@
+                               $mariadb_datadir
                 fi
        fi
 }
 
 mariadb_prestart() {
-       if ! [ -f @MARIADB_DATADIR@/mysql/user.frm ]; then
+       if ! [ -f $mariadb_datadir/mysql/user.frm ]; then
                mariadb_initdb
        fi
        rundir=$(dirname "${pidfile}")
@@ -53,5 +61,4 @@
        ulimit -n 4096
 }
 
-load_rc_config $name
 run_rc_command "$1"
diff -r c46c93cba31e -r 3afc8fc6906e databases/mariadb106-server/Makefile
--- a/databases/mariadb106-server/Makefile      Sun Feb 06 17:42:57 2022 +0000
+++ b/databases/mariadb106-server/Makefile      Sun Feb 06 17:52:24 2022 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.10 2022/01/10 01:46:27 ryoon Exp $
+# $NetBSD: Makefile,v 1.11 2022/02/06 17:52:25 abs Exp $
 
 PKGNAME=       ${DISTNAME:S/-/-server-/}
-PKGREVISION=   2
+PKGREVISION=   3
 COMMENT=       MariaDB 10.6, a free MySQL compatible database (server)
 
 CONFLICTS=     mysql-server-[0-9]*
diff -r c46c93cba31e -r 3afc8fc6906e databases/mariadb106-server/files/mariadb.sh
--- a/databases/mariadb106-server/files/mariadb.sh      Sun Feb 06 17:42:57 2022 +0000
+++ b/databases/mariadb106-server/files/mariadb.sh      Sun Feb 06 17:52:24 2022 +0000
@@ -1,11 +1,14 @@
 #!/bin/sh
 #
-# $NetBSD: mariadb.sh,v 1.2 2021/08/12 10:51:32 nia Exp $
+# $NetBSD: mariadb.sh,v 1.3 2022/02/06 17:52:25 abs Exp $
 #
 # PROVIDE: mariadb mysqld
 # REQUIRE: DAEMON LOGIN mountall
 # KEYWORD: shutdown
 #
+# Optional rc.conf variables:
+#      mariadb_flags=""                   # additional mariadb startup flags
+#      mariadb_datadir="/path/to/datadir" # path to mariadb datadir
 
 if [ -f /etc/rc.subr ]
 then
@@ -14,35 +17,40 @@
 
 name="mariadb"
 rcvar=${name}
+
+load_rc_config $name
+: ${mariadb_datadir:=@MARIADB_DATADIR@}
+
 procname="@PREFIX@/sbin/mariadbd"
 command="@PREFIX@/bin/mariadbd-safe"
 command_args="--pid-file=@VARBASE@/run/mariadb/mariadb.pid"
 command_args="${command_args} --user=@MARIADB_USER@"
-command_args="${command_args} --datadir=@MARIADB_DATADIR@"
-command_args="${command_args} --log-error=@VARBASE@/log/mariadb/error.log &"
+command_args="${command_args} --datadir=$mariadb_datadir"
+command_args="${command_args} --log-error=@VARBASE@/log/mariadb/error.log"
+command_args="${command_args} ${mariadb_flags} &"
 extra_commands="initdb"
 initdb_cmd="mariadb_initdb"
 start_precmd="mariadb_prestart"
 pidfile="@VARBASE@/run/mariadb/mariadb.pid"
 
 mariadb_initdb() {
-        if [ -f @MARIADB_DATADIR@/mysql/user.frm ]; then
+        if [ -f $mariadb_datadir/mysql/user.frm ]; then
                 echo "The MariaDB database has already been initialized."
                 echo "Skipping database initialization."
         else
                echo "Initializing MariaDB database system tables."
                sh @PREFIX@/bin/mysql_install_db --force \
                        --user=@MARIADB_USER@ \
-                       --datadir=@MARIADB_DATADIR@
-               if [ -d @MARIADB_DATADIR@ ]; then
+                       --datadir=$mariadb_datadir
+               if [ -d $mariadb_datadir ]; then
                        /usr/sbin/chown -R @MARIADB_USER@:@MARIADB_GROUP@ \
-                               @MARIADB_DATADIR@
+                               $mariadb_datadir
                 fi
        fi
 }
 
 mariadb_prestart() {
-       if ! [ -f @MARIADB_DATADIR@/mysql/user.frm ]; then
+       if ! [ -f $mariadb_datadir/mysql/user.frm ]; then
                mariadb_initdb
        fi
        rundir=$(dirname "${pidfile}")
@@ -53,5 +61,4 @@
        ulimit -n 4096
 }
 
-load_rc_config $name
 run_rc_command "$1"



Home | Main Index | Thread Index | Old Index