pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mariadb104: Fix rc script. I can now start mariadb.
Module Name: pkgsrc-wip
Committed By: nia <nia%netbsd.org@localhost>
Pushed By: nee
Date: Wed Apr 28 14:38:39 2021 +0200
Changeset: cee16b0105547e82d320e4f3f17c651d35a4621f
Modified Files:
mariadb104-client/distinfo
mariadb104-server/Makefile
mariadb104-server/files/mariadb.sh
mariadb104-server/files/smf/manifest.xml
mariadb104-server/files/smf/mariadb.sh
Added Files:
mariadb104-client/patches/patch-storage_connect_ioapi.c
Log Message:
mariadb104: Fix rc script. I can now start mariadb.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=cee16b0105547e82d320e4f3f17c651d35a4621f
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
mariadb104-client/distinfo | 1 +
.../patches/patch-storage_connect_ioapi.c | 15 +++
mariadb104-server/Makefile | 33 +++---
mariadb104-server/files/mariadb.sh | 118 ++++++---------------
mariadb104-server/files/smf/manifest.xml | 4 +-
mariadb104-server/files/smf/mariadb.sh | 8 +-
6 files changed, 69 insertions(+), 110 deletions(-)
diffs:
diff --git a/mariadb104-client/distinfo b/mariadb104-client/distinfo
index 567b556fbd..0b1456af95 100644
--- a/mariadb104-client/distinfo
+++ b/mariadb104-client/distinfo
@@ -15,6 +15,7 @@ SHA1 (patch-scripts_CMakeLists.txt) = 69d7adc8d50a23aeda4b9d9809cf64f6293703e0
SHA1 (patch-scripts_mysqld__safe.sh) = 4124e4c8df1527049f5eec9f3d2d4bbe80e7c33f
SHA1 (patch-sql_mysqld.cc) = 21f9ea79ca90a78f18598d55f209a1835b95858f
SHA1 (patch-sql_threadpool__generic.cc) = 73df368457a2e88f3cc3221031e565c4208b87ab
+SHA1 (patch-storage_connect_ioapi.c) = 804e2d9d3722fbe4d5ed773cc98a4114fe4cf8a3
SHA1 (patch-storage_connect_tabvct.cpp) = 2e3c7cd7e4b0a86d443da47d3cc514b8b276d836
SHA1 (patch-storage_rocksdb_rdb__io__watchdog.cc) = 85ee5007cfda0d3070ec20b2b774738b01f8e083
SHA1 (patch-storage_rocksdb_rdb__io__watchdog.h) = d790c092d7d35d014c5ef209635c18614c3a8301
diff --git a/mariadb104-client/patches/patch-storage_connect_ioapi.c b/mariadb104-client/patches/patch-storage_connect_ioapi.c
new file mode 100644
index 0000000000..a0fb66a8e7
--- /dev/null
+++ b/mariadb104-client/patches/patch-storage_connect_ioapi.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+NetBSD has no fopen64().
+
+--- storage/connect/ioapi.c.orig 2021-02-18 23:22:29.000000000 +0000
++++ storage/connect/ioapi.c
+@@ -14,7 +14,7 @@
+ #define _CRT_SECURE_NO_WARNINGS
+ #endif
+
+-#if defined(__APPLE__) || defined(IOAPI_NO_64)
++#if defined(__APPLE__) || defined(__NetBSD__) || defined(IOAPI_NO_64)
+ // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
+ #define FOPEN_FUNC(filename, mode) fopen(filename, mode)
+ #define FTELLO_FUNC(stream) ftello(stream)
diff --git a/mariadb104-server/Makefile b/mariadb104-server/Makefile
index 089e0c74b4..e994b730ac 100644
--- a/mariadb104-server/Makefile
+++ b/mariadb104-server/Makefile
@@ -20,33 +20,34 @@ BUILDLINK_DEPMETHOD.readline= build
CMAKE_ARGS+= -DPYTHON_SHEBANG=${PYTHONBIN}
+BUILD_DEFS+= VARBASE
+
.include "../../mk/bsd.fast.prefs.mk"
-MYSQL_USER?= mysql
-MYSQL_GROUP?= mysql
-MYSQL_PIDFILE?= ${MYSQL_DATADIR}/${HOST}.pid
+MARIADB_DATADIR?= ${VARBASE}/db/mariadb
+MARIADB_USER?= mariadb
+MARIADB_GROUP?= mariadb
-PKG_USERS_VARS+= MYSQL_USER
-PKG_GROUPS_VARS+= MYSQL_GROUP
+PKG_USERS_VARS+= MARIADB_USER
+PKG_GROUPS_VARS+= MARIADB_GROUP
-PKG_GROUPS= ${MYSQL_GROUP}
-PKG_USERS= ${MYSQL_USER}:${MYSQL_GROUP}
+PKG_GROUPS= ${MARIADB_GROUP}
+PKG_USERS= ${MARIADB_USER}:${MARIADB_GROUP}
-PKG_GECOS.${MYSQL_USER}= MariaDB administrator
-PKG_HOME.${MYSQL_USER}= ${MYSQL_DATADIR}
-PKG_SHELL.${MYSQL_USER}= ${SH}
+PKG_GECOS.${MARIADB_USER}= MariaDB administrator
+PKG_HOME.${MARIADB_USER}= ${MARIADB_DATADIR}
+PKG_SHELL.${MARIADB_USER}= ${SH}
RCD_SCRIPTS= mariadb
SMF_NAME= mariadb
SMF_METHODS= ${RCD_SCRIPTS}
FILES_SUBST+= HOSTNAME_CMD=${HOSTNAME_CMD:Q}
-FILES_SUBST+= MYSQL_DATADIR=${MYSQL_DATADIR}
-FILES_SUBST+= MYSQL_USER=${MYSQL_USER} MYSQL_GROUP=${MYSQL_GROUP}
-FILES_SUBST+= MYSQL_PIDFILE=${MYSQL_PIDFILE}
-MESSAGE_SUBST+= MYSQL_DATADIR=${MYSQL_DATADIR}
-MESSAGE_SUBST+= MYSQL_USER=${MYSQL_USER} MYSQL_GROUP=${MYSQL_GROUP}
-BUILD_DEFS+= MYSQL_DATADIR
+FILES_SUBST+= MARIADB_DATADIR=${MARIADB_DATADIR}
+FILES_SUBST+= MARIADB_USER=${MARIADB_USER} MARIADB_GROUP=${MARIADB_GROUP}
+BUILD_DEFS+= MARIADB_DATADIR
+
+OWN_DIRS+= ${VARBASE}/log/mariadb ${MARIADB_USER} ${MARIADB_GROUP} 0700
.include "../../archivers/lz4/buildlink3.mk"
.include "../../wip/mariadb104-client/buildlink3.mk"
diff --git a/mariadb104-server/files/mariadb.sh b/mariadb104-server/files/mariadb.sh
index 5d0d507ce6..38493d8f66 100644
--- a/mariadb104-server/files/mariadb.sh
+++ b/mariadb104-server/files/mariadb.sh
@@ -1,106 +1,48 @@
-#!@RCD_SCRIPTS_SHELL@
+#!/bin/sh
#
# $NetBSD$
#
-# PROVIDE: mariadb
+# PROVIDE: mariadb mysqld
# REQUIRE: DAEMON LOGIN mountall
# KEYWORD: shutdown
#
-# You will need to set some variables in /etc/rc.conf to start MariaDB:
-#
-# mariadb=YES
-#
-# The following variables are optional:
-#
-# mysqld_user="mysql" # user to run mysqld as
-# mysqld_datadir="/path/to/home" # path to MariaDB database directory
-# mysqld_pidfile="/path/to/p.pid" # path to MariaDB PID file
-if [ -f /etc/rc.subr ]; then
+if [ -f /etc/rc.subr ]
+then
. /etc/rc.subr
fi
-name="mysqld"
-rcvar="mariadb"
-command="@PREFIX@/bin/mysqld_safe"
-procname="@PREFIX@/sbin/${name}"
-: ${mysqld_user:=@MYSQL_USER@}
-: ${mysqld_group:=@MYSQL_GROUP@}
-: ${mysqld_datadir:=@MYSQL_DATADIR@}
-: ${mysqld_pidfile:=@MYSQL_PIDFILE@}
-
+name="mariadb"
+rcvar=${name}
+command="@PREFIX@/sbin/mysqld"
+command_args="--pid-file=@VARBASE@/run/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 &"
extra_commands="initdb"
-initdb_cmd="mysqld_initdb"
-start_precmd="mysqld_precmd"
-start_cmd="mysqld_start"
-
-mysqld_precmd()
-{
- if [ ! -d ${mysqld_datadir}/mysql ]; then
- ${initdb_cmd}
- fi
-}
+initdb_cmd="mariadb_initdb"
+start_precmd="mariadb_prestart"
+pidfile="@VARBASE@/run/mariadb.pid"
-mysqld_initdb()
-{
- initdb="@PREFIX@/bin/mysql_install_db"
- if [ ! -x ${initdb} ]; then
- return 1
- fi
- if [ -f ${mysqld_datadir}/mysql/host.frm ]; then
- @ECHO@ "The MariaDB database has already been initialized."
- @ECHO@ "Skipping database initialization."
- else
- @ECHO@ "Initializing MariaDB database system tables."
- ${initdb} --force --user=${mysqld_user} \
- --datadir=${mysqld_datadir} || return 1
- if [ -d ${mysqld_datadir} ]; then
- @CHOWN@ -R ${mysqld_user}:${mysqld_group} \
- ${mysqld_datadir}
- fi
+mariadb_initdb() {
+ if [ -f @MARIADB_DATADIR@/mysql/host.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 \
+ --datadir=@MARIADB_DATADIR@
+ if [ -d @MARIADB_DATADIR@ ]; then
+ /usr/sbin/chown -R @MARIADB_USER@:@MARIADB_GROUP@ \
+ @MARIADB_DATADIR@
+ fi
fi
}
-mysqld_start()
-{
- for f in $required_files; do
- if [ ! -r "$f" ]; then
- @ECHO@ 1>&2 "$0: WARNING: $f is not readable"
- if [ -z $rc_force ]; then
- return 1
- fi
- fi
- done
- @ECHO@ "Starting ${name} (MariaDB)."
+mariadb_prestart() {
ulimit -n 4096
- cd @PREFIX@
- ${command} --user=${mysqld_user} --datadir=${mysqld_datadir} \
- --pid-file=${mysqld_pidfile} ${mysqld_flags} \
- ${thread_flags} &
}
-if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
- load_rc_config $name
- pidfile="${mysqld_pidfile}"
- run_rc_command "$1"
-else
- if [ -f /etc/rc.conf ]; then
- . /etc/rc.conf
- fi
- pidfile="${mysqld_pidfile}"
- case "$1" in
- initdb)
- eval ${initdb_cmd}
- ;;
- stop)
- if [ -r "${pidfile}" ]; then
- @ECHO@ "Stopping ${name} (MariaDB)."
- kill `@CAT@ ${pidfile}`
- fi
- ;;
- *)
- eval ${start_precmd}
- eval ${start_cmd}
- ;;
- esac
-fi
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mariadb104-server/files/smf/manifest.xml b/mariadb104-server/files/smf/manifest.xml
index 4423bb1149..ba6d8a524e 100644
--- a/mariadb104-server/files/smf/manifest.xml
+++ b/mariadb104-server/files/smf/manifest.xml
@@ -10,8 +10,8 @@
<dependency name='net' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/network/loopback' />
</dependency>
- <method_context project='mysql' working_directory='@MYSQL_DATADIR@'>
- <method_credential user='@MYSQL_USER@' group='@MYSQL_GROUP@' />
+ <method_context project='mariadb' working_directory='@MARIADB_DATADIR@'>
+ <method_credential user='@MARIADB_USER@' group='@MARIADB_GROUP@' />
<method_environment>
<envvar name='LD_PRELOAD_32' value='/usr/lib/extendedFILE.so.1' />
</method_environment>
diff --git a/mariadb104-server/files/smf/mariadb.sh b/mariadb104-server/files/smf/mariadb.sh
index 607093bad2..c5993e1f89 100644
--- a/mariadb104-server/files/smf/mariadb.sh
+++ b/mariadb104-server/files/smf/mariadb.sh
@@ -7,17 +7,17 @@
. /lib/svc/share/smf_include.sh
-PIDFILE="@MYSQL_DATADIR@/mysql.pid"
+PIDFILE="@VARBASE@/run/mariadb.pid"
ulimit -n 10240
case "$1" in
start)
- @LOCALBASE@/sbin/mysqld --user=mysql \
+ @LOCALBASE@/sbin/mysqld --user=@MARIADB_USER@ \
--basedir=@LOCALBASE@ \
- --datadir=@MYSQL_DATADIR@ \
+ --datadir=@MARIADB_DATADIR@ \
--pid-file=${PIDFILE} \
- --log-error=@VARBASE@/log/mysql/error.log &
+ --log-error=@VARBASE@/log/mariadb/error.log &
;;
stop)
[ -f ${PIDFILE} ] && kill `@HEAD@ -1 ${PIDFILE}`
Home |
Main Index |
Thread Index |
Old Index