Update to 4.1.10 release:
- Add the possibility to specify the database directory in rc.conf [1] - Move database creation from post-install stage into startup script PR: ports/75453 [1] Submitted by: Boris Kovalenko <boris@tagnet.ru> [1]
This commit is contained in:
parent
502b9a2ca9
commit
110771c2d9
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=128973
@ -6,7 +6,7 @@
|
||||
#
|
||||
|
||||
PORTNAME?= mysql
|
||||
PORTVERSION= 4.1.9
|
||||
PORTVERSION= 4.1.10
|
||||
PORTREVISION?= 0
|
||||
CATEGORIES= databases
|
||||
MASTER_SITES= ${MASTER_SITE_MYSQL}
|
||||
@ -17,14 +17,15 @@ MAINTAINER= ale@FreeBSD.org
|
||||
COMMENT?= Multithreaded SQL database (server)
|
||||
|
||||
SLAVEDIRS= databases/mysql41-client
|
||||
PKGINSTALL?= ${WRKDIR}/pkg-install
|
||||
DB_DIR?= /var/db/mysql
|
||||
USE_LIBTOOL_VER=15
|
||||
USE_REINPLACE= yes
|
||||
USE_RC_SUBR= yes
|
||||
|
||||
.if ${PKGNAMESUFFIX} == "-server"
|
||||
USE_RC_SUBR= mysql-server.sh
|
||||
.endif
|
||||
|
||||
CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
|
||||
CONFIGURE_ARGS= --localstatedir=${DB_DIR} \
|
||||
CONFIGURE_ARGS= --localstatedir=/var/db/mysql \
|
||||
--without-debug \
|
||||
--without-readline \
|
||||
--without-libedit \
|
||||
@ -106,15 +107,13 @@ LATEST_LINK= mysql41-server
|
||||
|
||||
CONFLICTS= mysql-server-3.* mysql-server-4.[02-9].* mysql-server-5.*
|
||||
|
||||
PLIST_SUB= DB_DIR=${DB_DIR} \
|
||||
VER=${PORTVERSION}
|
||||
PLIST_SUB= VER=${PORTVERSION}
|
||||
.if defined(WITH_NDB)
|
||||
PLIST_SUB+= NDB=""
|
||||
.else
|
||||
PLIST_SUB+= NDB="@comment "
|
||||
.endif
|
||||
|
||||
|
||||
MAN1= isamchk.1 isamlog.1 mysqld.1 \
|
||||
mysqld_safe.1 perror.1 replace.1
|
||||
|
||||
@ -131,8 +130,6 @@ pre-fetch:
|
||||
@${ECHO} " WITH_CHARSET=charset Define the primary built-in charset (latin1)."
|
||||
@${ECHO} " WITH_XCHARSET=list Define other built-in charsets (may be 'all')."
|
||||
@${ECHO} " WITH_OPENSSL=yes Enable secure connections."
|
||||
@${ECHO} " DB_DIR=directory Set alternate directory for database files"
|
||||
@${ECHO} " (default is /var/db/mysql)."
|
||||
@${ECHO} " WITH_LINUXTHREADS=yes Use the linuxthreads pthread library."
|
||||
@${ECHO} " WITH_PROC_SCOPE_PTH=yes Use process scope threads"
|
||||
@${ECHO} " (try it if you use libpthread)."
|
||||
@ -156,22 +153,10 @@ post-patch:
|
||||
@${REINPLACE_CMD} -e "s|PTHREAD_SCOPE_SYSTEM|PTHREAD_SCOPE_PROCESS|g" ${WRKSRC}/sql/mysqld.cc
|
||||
.endif
|
||||
|
||||
post-build:
|
||||
@${SED} "s|%%DB_DIR%%|${DB_DIR}|g" ${PKGDIR}/pkg-install > ${WRKDIR}/pkg-install
|
||||
|
||||
post-install:
|
||||
.if !defined(PACKAGE_BUILDING)
|
||||
.if exists(${DB_DIR}) && defined(OVERWRITE_DB) && ${OVERWRITE_DB:L} != "no"
|
||||
@${RM} -r ${DB_DIR}/mysql ${DB_DIR}/test 2>/dev/null || true
|
||||
@${SETENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
||||
.endif
|
||||
.if !exists(${DB_DIR}) || (defined(OVERWRITE_DB) && ${OVERWRITE_DB:L} != "no")
|
||||
${PREFIX}/bin/mysql_install_db --ldata=${DB_DIR}
|
||||
.endif
|
||||
@${SETENV} DB_DIR=${DB_DIR} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
|
||||
.endif
|
||||
@${SED} "s|%%RC_SUBR%%|${RC_SUBR}|g;s|%%PREFIX%%|${PREFIX}|g;s|%%DB_DIR%%|${DB_DIR}|g" < \
|
||||
${FILESDIR}/mysql-server.sh > ${PREFIX}/etc/rc.d/mysql-server.sh
|
||||
@${CHMOD} 750 ${PREFIX}/etc/rc.d/mysql-server.sh
|
||||
.if !defined(NOPORTDOCS)
|
||||
@${MKDIR} ${DOCSDIR}
|
||||
.for doc in ${PORTDOCS}
|
||||
@ -219,7 +204,6 @@ RUN_DEPENDS= ${SITE_PERL}/${PERL_ARCH}/Mysql.pm:${PORTSDIR}/databases/p5-DBD-mys
|
||||
RUN_DEPENDS+= ${SITE_PERL}/File/Temp.pm:${PORTSDIR}/devel/p5-File-Temp
|
||||
.endif
|
||||
|
||||
|
||||
LATEST_LINK= mysql41-scripts
|
||||
|
||||
CONFLICTS= mysql-scripts-3.* mysql-scripts-4.[02-9].* mysql-scripts-5.*
|
||||
|
@ -1,2 +1,2 @@
|
||||
MD5 (mysql-4.1.9.tar.gz) = 7bc44befe155d619c4e4705f68874278
|
||||
SIZE (mysql-4.1.9.tar.gz) = 22308321
|
||||
MD5 (mysql-4.1.10.tar.gz) = 27b27b74f430aaeb77fb8d4e6f32ac4d
|
||||
SIZE (mysql-4.1.10.tar.gz) = 22563415
|
||||
|
@ -1,51 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# PROVIDE: mysql
|
||||
# REQUIRE: NETWORKING SERVERS
|
||||
# BEFORE: DAEMON
|
||||
# KEYWORD: shutdown
|
||||
|
||||
#
|
||||
# Add the following line to /etc/rc.conf to enable mysql:
|
||||
# mysql_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable MySQL.
|
||||
# mysqllimits_enable (bool): Set to "NO" by default.
|
||||
# Set it to yes to run `limits $limits_args`
|
||||
# just before mysql starts.
|
||||
# mysqllimits_args (str): Default to "-e -U mysql"
|
||||
# Arguments of pre-start limits run.
|
||||
#
|
||||
|
||||
. %%RC_SUBR%%
|
||||
|
||||
name="mysql"
|
||||
rcvar=`set_rcvar`
|
||||
mysql_dbdir="%%DB_DIR%%"
|
||||
mysql_user="mysql"
|
||||
pidfile="${mysql_dbdir}/`/bin/hostname`.pid"
|
||||
command="%%PREFIX%%/bin/mysqld_safe"
|
||||
command_args="--user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} > /dev/null &"
|
||||
procname="%%PREFIX%%/libexec/mysqld"
|
||||
start_precmd="${name}_prestart"
|
||||
|
||||
[ -z "$mysql_enable" ] && mysql_enable="NO"
|
||||
[ -z "$mysqllimits_enable" ] && mysqllimits_enable="NO"
|
||||
[ -z "$mysqllimits_args" ] && mysqllimits_args="-e -U ${mysql_user}"
|
||||
|
||||
mysql_prestart()
|
||||
{
|
||||
if checkyesno mysqllimits_enable; then
|
||||
eval `/usr/bin/limits ${mysqllimits_args}` 2>/dev/null
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
required_dirs="${mysql_dbdir}"
|
||||
required_files="${mysql_dbdir}/mysql/host.frm ${mysql_dbdir}/mysql/user.frm ${mysql_dbdir}/mysql/db.frm"
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
61
databases/mysql41-server/files/mysql-server.sh.in
Normal file
61
databases/mysql41-server/files/mysql-server.sh.in
Normal file
@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
# PROVIDE: mysql
|
||||
# REQUIRE: NETWORKING SERVERS
|
||||
# BEFORE: DAEMON
|
||||
# KEYWORD: shutdown
|
||||
|
||||
#
|
||||
# Add the following line to /etc/rc.conf to enable mysql:
|
||||
# mysql_enable (bool): Set to "NO" by default.
|
||||
# Set it to "YES" to enable MySQL.
|
||||
# mysql_limits (bool): Set to "NO" by default.
|
||||
# Set it to yes to run `limits -e -U mysql`
|
||||
# just before mysql starts.
|
||||
# mysql_dbdir (str): Default to "/var/db/mysql"
|
||||
# Base database directory.
|
||||
#
|
||||
|
||||
. %%RC_SUBR%%
|
||||
|
||||
name="mysql"
|
||||
rcvar=`set_rcvar`
|
||||
|
||||
load_rc_config $name
|
||||
|
||||
: ${mysql_enable="NO"}
|
||||
: ${mysql_limits="NO"}
|
||||
: ${mysql_dbdir="/var/db/mysql"}
|
||||
|
||||
mysql_user="mysql"
|
||||
mysql_limits_args="-e -U ${mysql_user}"
|
||||
pidfile="${mysql_dbdir}/`/bin/hostname`.pid"
|
||||
command="%%PREFIX%%/bin/mysqld_safe"
|
||||
command_args="--user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} > /dev/null &"
|
||||
procname="%%PREFIX%%/libexec/mysqld"
|
||||
start_precmd="${name}_prestart"
|
||||
mysql_install_db="%%PREFIX%%/bin/mysql_install_db"
|
||||
mysql_install_db_args="--ldata=${mysql_dbdir}"
|
||||
|
||||
mysql_create_auth_tables()
|
||||
{
|
||||
eval $mysql_install_db $mysql_install_db_args >/dev/null
|
||||
[ $? -eq 0 ] && chown -R ${mysql_user}:${mysql_user} ${mysql_dbdir}
|
||||
}
|
||||
|
||||
mysql_prestart()
|
||||
{
|
||||
if [ ! -d "${mysql_dbdir}/mysql/." ]; then
|
||||
mysql_create_auth_tables || return 1
|
||||
fi
|
||||
if checkyesno mysql_limits; then
|
||||
eval `/usr/bin/limits ${mysql_limits_args}` 2>/dev/null
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
run_rc_command "$1"
|
@ -1,90 +0,0 @@
|
||||
--- scripts/mysqlaccess.sh.orig 2005-01-16 14:28:38 -08:00
|
||||
+++ scripts/mysqlaccess.sh 2005-01-16 14:28:38 -08:00
|
||||
@@ -2,7 +2,7 @@
|
||||
# ****************************
|
||||
package MySQLaccess;
|
||||
#use strict;
|
||||
-use POSIX qw(tmpnam);
|
||||
+use File::Temp qw(tempfile tmpnam);
|
||||
use Fcntl;
|
||||
|
||||
BEGIN {
|
||||
@@ -32,7 +32,6 @@
|
||||
$ACCESS_U_BCK = 'user_backup';
|
||||
$ACCESS_D_BCK = 'db_backup';
|
||||
$DIFF = '/usr/bin/diff';
|
||||
- $TMP_PATH = '/tmp'; #path to writable tmp-directory
|
||||
$MYSQLDUMP = '@bindir@/mysqldump';
|
||||
#path to mysqldump executable
|
||||
|
||||
@@ -432,7 +431,7 @@
|
||||
# no caching on STDOUT
|
||||
$|=1;
|
||||
|
||||
- $MYSQL_CNF = POSIX::tmpnam();
|
||||
+ $MYSQL_CNF = tmpnam();
|
||||
%MYSQL_CNF = (client => { },
|
||||
mysql => { },
|
||||
mysqldump => { },
|
||||
@@ -577,8 +576,6 @@
|
||||
push(@MySQLaccess::Grant::Error,'not_found_mysql') if !(-x $MYSQL);
|
||||
push(@MySQLaccess::Grant::Error,'not_found_diff') if !(-x $DIFF);
|
||||
push(@MySQLaccess::Grant::Error,'not_found_mysqldump') if !(-x $MYSQLDUMP);
|
||||
-push(@MySQLaccess::Grant::Error,'not_found_tmp') if !(-d $TMP_PATH);
|
||||
-push(@MySQLaccess::Grant::Error,'write_err_tmp') if !(-w $TMP_PATH);
|
||||
if (@MySQLaccess::Grant::Error) {
|
||||
MySQLaccess::Report::Print_Error_Messages() ;
|
||||
exit 0;
|
||||
@@ -1777,17 +1774,15 @@
|
||||
@before = sort(@before);
|
||||
@after = sort(@after);
|
||||
|
||||
- $before = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.before.$$";
|
||||
- $after = "$MySQLaccess::TMP_PATH/$MySQLaccess::script.after.$$";
|
||||
- #$after = "/tmp/t0";
|
||||
- open(BEFORE,"> $before") ||
|
||||
- push(@MySQLaccess::Report::Errors,"Can't open temporary file $before for writing");
|
||||
- open(AFTER,"> $after") ||
|
||||
- push(@MySQLaccess::Report::Errors,"Can't open temporary file $after for writing");
|
||||
- print BEFORE join("\n",@before);
|
||||
- print AFTER join("\n",@after);
|
||||
- close(BEFORE);
|
||||
- close(AFTER);
|
||||
+ ($hb, $before) = tempfile("$MySQLaccess::script.XXXXXX") or
|
||||
+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
|
||||
+ ($ha, $after) = tempfile("$MySQLaccess::script.XXXXXX") or
|
||||
+ push(@MySQLaccess::Report::Errors,"Can't create temporary file: $!");
|
||||
+
|
||||
+ print $hb join("\n",@before);
|
||||
+ print $ha join("\n",@after);
|
||||
+ close $hb;
|
||||
+ close $ha;
|
||||
|
||||
# ----------------------------------
|
||||
# compute difference
|
||||
@@ -1800,8 +1795,8 @@
|
||||
|
||||
# ----------------------------------
|
||||
# cleanup temp. files
|
||||
- unlink(BEFORE);
|
||||
- unlink(AFTER);
|
||||
+ unlink($before);
|
||||
+ unlink($after);
|
||||
|
||||
return \@diffs;
|
||||
}
|
||||
@@ -2316,14 +2311,6 @@
|
||||
=> "The diff program <$MySQLaccess::DIFF> could not be found.\n"
|
||||
."+ Check your path, or\n"
|
||||
."+ edit the source of this script to point \$DIFF to the diff program.\n"
|
||||
- ,'not_found_tmp'
|
||||
- => "The temporary directory <$MySQLaccess::TMP_PATH> could not be found.\n"
|
||||
- ."+ create this directory (writeable!), or\n"
|
||||
- ."+ edit the source of this script to point \$TMP_PATH to the right directory.\n"
|
||||
- ,'write_err_tmp'
|
||||
- => "The temporary directory <$MySQLaccess::TMP_PATH> is not writable.\n"
|
||||
- ."+ make this directory writeable!, or\n"
|
||||
- ."+ edit the source of this script to point \$TMP_PATH to another directory.\n"
|
||||
,'Unrecognized_option'
|
||||
=> "Sorry,\n"
|
||||
."You are using an old version of the mysql-program,\n"
|
@ -8,7 +8,6 @@ POST-INSTALL)
|
||||
GROUP=${USER}
|
||||
UID=88
|
||||
GID=${UID}
|
||||
DB_DIR=%%DB_DIR%%
|
||||
|
||||
if pw group show "${GROUP}" 2>/dev/null; then
|
||||
echo "You already have a group \"${GROUP}\", so I will use it."
|
||||
@ -23,16 +22,9 @@ POST-INSTALL)
|
||||
|
||||
if pw user show "${USER}" 2>/dev/null; then
|
||||
echo "You already have a user \"${USER}\", so I will use it."
|
||||
if pw usermod ${USER} -d ${DB_DIR}
|
||||
then
|
||||
echo "Changed home directory of \"${USER}\" to \"${DB_DIR}\""
|
||||
else
|
||||
echo "Changing home directory of \"${USER}\" to \"${DB_DIR}\" failed..."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
|
||||
-d ${DB_DIR} -s /sbin/nologin -c "MySQL Daemon"
|
||||
-d /nonexistent -s /sbin/nologin -c "MySQL Daemon"
|
||||
then
|
||||
echo "Added user \"${USER}\"."
|
||||
else
|
||||
@ -40,7 +32,5 @@ POST-INSTALL)
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
chown -R ${USER}:${GROUP} ${DB_DIR}
|
||||
;;
|
||||
esac
|
||||
|
@ -27,7 +27,6 @@ bin/perror
|
||||
bin/replace
|
||||
bin/resolve_stack_dump
|
||||
bin/resolveip
|
||||
etc/rc.d/mysql-server.sh
|
||||
%%NDB%%include/mysql/ndb/mgmapi/mgmapi.h
|
||||
%%NDB%%include/mysql/ndb/mgmapi/mgmapi_config_parameters.h
|
||||
%%NDB%%include/mysql/ndb/mgmapi/mgmapi_config_parameters_debug.h
|
||||
@ -53,6 +52,7 @@ etc/rc.d/mysql-server.sh
|
||||
%%NDB%%include/mysql/ndb/ndbapi/NdbScanFilter.hpp
|
||||
%%NDB%%include/mysql/ndb/ndbapi/NdbScanOperation.hpp
|
||||
%%NDB%%include/mysql/ndb/ndbapi/ndb_cluster_connection.hpp
|
||||
%%NDB%%include/mysql/ndb/ndbapi/ndb_opt_defaults.h
|
||||
%%NDB%%include/mysql/ndb/ndbapi/ndbapi_limits.h
|
||||
%%NDB%%include/mysql/ndb/ndbapi/ndberror.h
|
||||
lib/mysql/libdbug.a
|
||||
@ -126,6 +126,8 @@ libexec/mysqld
|
||||
%%DATADIR%%/italian/errmsg.txt
|
||||
%%DATADIR%%/japanese/errmsg.sys
|
||||
%%DATADIR%%/japanese/errmsg.txt
|
||||
%%DATADIR%%/japanese-sjis/errmsg.sys
|
||||
%%DATADIR%%/japanese-sjis/errmsg.txt
|
||||
%%DATADIR%%/korean/errmsg.sys
|
||||
%%DATADIR%%/korean/errmsg.txt
|
||||
%%DATADIR%%/mi_test_all
|
||||
@ -138,6 +140,7 @@ libexec/mysqld
|
||||
%%DATADIR%%/mysql-%%VER%%.spec
|
||||
%%DATADIR%%/mysql-log-rotate
|
||||
%%DATADIR%%/mysql.server
|
||||
%%DATADIR%%/ndb-config-2-node.ini
|
||||
%%DATADIR%%/norwegian-ny/errmsg.sys
|
||||
%%DATADIR%%/norwegian-ny/errmsg.txt
|
||||
%%DATADIR%%/norwegian/errmsg.sys
|
||||
@ -177,6 +180,7 @@ libexec/mysqld
|
||||
@dirrm %%DATADIR%%/hungarian
|
||||
@dirrm %%DATADIR%%/italian
|
||||
@dirrm %%DATADIR%%/japanese
|
||||
@dirrm %%DATADIR%%/japanese-sjis
|
||||
@dirrm %%DATADIR%%/korean
|
||||
@dirrm %%DATADIR%%/norwegian
|
||||
@dirrm %%DATADIR%%/norwegian-ny
|
||||
@ -190,5 +194,4 @@ libexec/mysqld
|
||||
@dirrm %%DATADIR%%/swedish
|
||||
@dirrm %%DATADIR%%/ukrainian
|
||||
@unexec rmdir %D/%%DATADIR%% 2> /dev/null || true
|
||||
@exec [ -d %%DB_DIR%% ] || %D/bin/mysql_install_db --ldata=%%DB_DIR%%
|
||||
@unexec /usr/bin/killall mysqld > /dev/null 2>&1 || true
|
||||
|
Loading…
Reference in New Issue
Block a user