diff options
author | lukem <lukem@pkgsrc.org> | 2003-01-21 06:02:41 +0000 |
---|---|---|
committer | lukem <lukem@pkgsrc.org> | 2003-01-21 06:02:41 +0000 |
commit | 399ea1cba45e8962841c038ee6221e5f7e7f4319 (patch) | |
tree | 7894285fd6926c5faabfd34aaa2a39d799510e1f | |
parent | 4592e34b41a58e153460255411025c137a8c8473 (diff) | |
download | pkgsrc-399ea1cba45e8962841c038ee6221e5f7e7f4319.tar.gz |
- add rc.d script; based on [pkg/19055], with rework by me.
- add support for MYSQL_USER and MYSQL_GROUP (user & group to run database as)
- change ownership of $MYSQL_DATADIR to ${MYSQL_USER}:${MYSQL_GROUP} 700
- fix safe_mysqld to send all output to the error log and to NOT output
random messages to the tty it was started on.
- display a MESSAGE reminding people to change the password of the
mysql 'root' user.
- bump PKGREVISION (to 3.23.49nb2)
-rw-r--r-- | databases/mysql-server/DEINSTALL | 6 | ||||
-rw-r--r-- | databases/mysql-server/INSTALL | 6 | ||||
-rw-r--r-- | databases/mysql-server/MESSAGE | 4 | ||||
-rw-r--r-- | databases/mysql-server/Makefile | 17 | ||||
-rw-r--r-- | databases/mysql-server/PLIST | 3 | ||||
-rw-r--r-- | databases/mysql-server/distinfo | 3 | ||||
-rw-r--r-- | databases/mysql-server/files/mysqld.sh | 31 | ||||
-rw-r--r-- | databases/mysql-server/patches/patch-am | 94 |
8 files changed, 153 insertions, 11 deletions
diff --git a/databases/mysql-server/DEINSTALL b/databases/mysql-server/DEINSTALL index bf7c32be686..d7ed9b322bc 100644 --- a/databases/mysql-server/DEINSTALL +++ b/databases/mysql-server/DEINSTALL @@ -1,9 +1,9 @@ #!/bin/sh # -# $NetBSD: DEINSTALL,v 1.1 2001/11/01 00:11:53 zuntum Exp $ +# $NetBSD: DEINSTALL,v 1.2 2003/01/21 06:02:41 lukem Exp $ -PKGNAME=$1 -STAGE=$2 +: ${PKGNAME:=$1} +: ${STAGE:=$2} MYSQL_DATADIR="@MYSQL_DATADIR@" diff --git a/databases/mysql-server/INSTALL b/databases/mysql-server/INSTALL index 4bccf0baac2..7a7d8ac0dfe 100644 --- a/databases/mysql-server/INSTALL +++ b/databases/mysql-server/INSTALL @@ -1,9 +1,9 @@ #!/bin/sh # -# $NetBSD: INSTALL,v 1.1 2001/11/01 00:11:53 zuntum Exp $ +# $NetBSD: INSTALL,v 1.2 2003/01/21 06:02:41 lukem Exp $ -PKGNAME=$1 -STAGE=$2 +: ${PKGNAME:=$1} +: ${STAGE:=$2} case ${STAGE} in PRE-INSTALL) diff --git a/databases/mysql-server/MESSAGE b/databases/mysql-server/MESSAGE new file mode 100644 index 00000000000..2883d6da8ad --- /dev/null +++ b/databases/mysql-server/MESSAGE @@ -0,0 +1,4 @@ +If this is a new installation, please remember to set a password for +the MySQL root user! This is done with: + ${PREFIX}/bin/mysqladmin -u root -p password 'new-password' +See the manual for more instructions. diff --git a/databases/mysql-server/Makefile b/databases/mysql-server/Makefile index 9061ece6967..6bf0475a135 100644 --- a/databases/mysql-server/Makefile +++ b/databases/mysql-server/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.32 2003/01/20 18:09:08 jdolecek Exp $ +# $NetBSD: Makefile,v 1.33 2003/01/21 06:02:41 lukem Exp $ PKGNAME= ${DISTNAME:S/-/-server-/} -PKGREVISION= 1 +PKGREVISION= 2 SVR4_PKGNAME= mysqs COMMENT= MySQL, a free SQL database (server) @@ -12,10 +12,11 @@ CONFIGURE_ARGS+= --without-berkeley-db USE_BUILDLINK2= YES USE_GMAKE= YES + ONLY_FOR_PLATFORM= SunOS-*-sparc Linux-*-* # on NetBSD, if native threads are not available, hardwire -# included mit-pthreads +# included mit-pthreads, as this doesn't yet work properly with pth .if (${OPSYS} == "NetBSD") .if (exists(/usr/include/pthread.h)) @@ -32,8 +33,17 @@ ONLY_FOR_PLATFORM+= NetBSD-*-alpha NetBSD-*-arm32 NetBSD-*-i386 \ .endif .endif + DEINSTALL_FILE= ${WRKDIR}/DEINSTALL +PKG_USERS= ${MYSQL_USER}:${MYSQL_GROUP}::MySQL\\ database\\ administrator:${MYSQL_DATADIR}:${SH} +PKG_GROUPS= ${MYSQL_GROUP} +RCD_SCRIPTS= mysqld +CONFIGURE_ARGS+= --with-mysqld-user=${MYSQL_USER} +FILES_SUBST+= MYSQL_DATADIR=${MYSQL_DATADIR} +BUILD_DEFS+= MYSQL_DATADIR +MAKE_DIRS_PERMS+= ${MYSQL_DATADIR} ${MYSQL_USER} ${MYSQL_GROUP} 0700 + post-configure: cd ${WRKSRC} && ${CP} -f config.h include/my_config.h @@ -55,4 +65,5 @@ post-install: .include "../../databases/mysql-client/buildlink2.mk" .include "../../security/tcp_wrappers/buildlink2.mk" +.include "../../mk/bsd.pkg.install.mk" .include "../../mk/bsd.pkg.mk" diff --git a/databases/mysql-server/PLIST b/databases/mysql-server/PLIST index 4a3fc88d00f..691c213636c 100644 --- a/databases/mysql-server/PLIST +++ b/databases/mysql-server/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.1 2001/11/01 00:11:53 zuntum Exp $ +@comment $NetBSD: PLIST,v 1.2 2003/01/21 06:02:41 lukem Exp $ bin/comp_err bin/isamchk bin/isamlog @@ -13,6 +13,7 @@ bin/replace bin/resolve_stack_dump bin/resolveip bin/safe_mysqld +etc/rc.d/mysqld lib/mysql/libdbug.a lib/mysql/libheap.a lib/mysql/libmerge.a diff --git a/databases/mysql-server/distinfo b/databases/mysql-server/distinfo index 6ef1de98a06..44c87ea40fd 100644 --- a/databases/mysql-server/distinfo +++ b/databases/mysql-server/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.18 2003/01/20 17:48:45 jdolecek Exp $ +$NetBSD: distinfo,v 1.19 2003/01/21 06:02:41 lukem Exp $ SHA1 (mysql-3.23.49.tar.gz) = 0256331c7aa9388955148f80cdca382f467ad1be Size (mysql-3.23.49.tar.gz) = 11844905 bytes @@ -14,3 +14,4 @@ SHA1 (patch-ai) = 071e34cc9236b08cdc438afbb46801e66efc7e92 SHA1 (patch-aj) = 2e619c6f16a1256174fd3e6e4bca3214679a9347 SHA1 (patch-ak) = f484f0bd5b77e0475c7b693b51f5f5146795afa0 SHA1 (patch-al) = 75b237ea28da2b44f05c0c0fb3493bba060004dc +SHA1 (patch-am) = adc14bcc3bd21e5a522e1a732ded223b641a2ac7 diff --git a/databases/mysql-server/files/mysqld.sh b/databases/mysql-server/files/mysqld.sh new file mode 100644 index 00000000000..8c3767c4473 --- /dev/null +++ b/databases/mysql-server/files/mysqld.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# $NetBSD: mysqld.sh,v 1.1 2003/01/21 06:02:42 lukem Exp $ +# + +# PROVIDE: mysqld +# REQUIRE: DAEMON LOGIN mountall +# KEYWORD: shutdown + +# Note: this needs NetBSD 1.6 or newer +# + +. /etc/rc.subr + +name="mysqld" +rcvar=$name +command="@PREFIX@/bin/safe_mysqld" +procname="@PREFIX@/libexec/${name}" +pidfile="@MYSQL_DATADIR@/`hostname`.pid" +start_cmd="mysqld_start" +required_files="@MYSQL_DATADIR@/mysql/host.frm" + +mysqld_start() +{ + echo "Starting mysqld." + ulimit -n 4096 + ${command} ${mysqld_flags} & +} + +load_rc_config $name +run_rc_command "$1" diff --git a/databases/mysql-server/patches/patch-am b/databases/mysql-server/patches/patch-am new file mode 100644 index 00000000000..0a90bbd7d66 --- /dev/null +++ b/databases/mysql-server/patches/patch-am @@ -0,0 +1,94 @@ +$NetBSD: patch-am,v 1.3 2003/01/21 06:02:42 lukem Exp $ + +--- scripts/safe_mysqld.sh.orig Tue Jan 21 16:11:16 2003 ++++ scripts/safe_mysqld.sh +@@ -184,6 +184,14 @@ then + fi + fi + ++datemsg() ++{ ++ echo -n $(date +'%y%M%d %H:%M:%S')" " ++ echo "$*" ++} ++ ++exec >>$err_log 2>&1 ++ + # + # If there exists an old pid file, check if the daemon is already running + # Note: The switches to 'ps' may depend on your operating system +@@ -194,18 +202,16 @@ then + then + if @FIND_PROC@ + then # The pid contains a mysqld process +- echo "A mysqld process already exists" +- echo "A mysqld process already exists at " `date` >> $err_log ++ datemsg "A mysqld process already exists" + exit 1 + fi + fi + rm -f $pid_file + if test -f $pid_file + then +- echo "Fatal error: Can't remove the pid file: $pid_file" +- echo "Fatal error: Can't remove the pid file: $pid_file at " `date` >> $err_log +- echo "Please remove it manually and start $0 again" +- echo "mysqld daemon not started" ++ datemsg "Fatal error: Can't remove the pid file: $pid_file" ++ datemsg "Please remove it manually and start $0 again" ++ datemsg "mysqld daemon not started" + exit 1 + fi + fi +@@ -214,11 +220,11 @@ fi + # Uncomment the following lines if you want all tables to be automaticly + # checked and repaired at start + # +-# echo "Checking tables in $DATADIR" ++# datemsg "Checking tables in $DATADIR" + # $MY_BASEDIR_VERSION/bin/myisamchk --silent --force --fast --medium-check -O key_buffer=64M -O sort_buffer=64M $DATADIR/*/*.MYI + # $MY_BASEDIR_VERSION/bin/isamchk --silent --force -O sort_buffer=64M $DATADIR/*/*.ISM + +-echo "Starting $MYSQLD daemon with databases from $DATADIR" ++datemsg "Starting $MYSQLD daemon with databases from $DATADIR" + + # Does this work on all systems? + #if type ulimit | grep "shell builtin" > /dev/null +@@ -226,7 +232,7 @@ echo "Starting $MYSQLD daemon with datab + # ulimit -n 256 > /dev/null 2>&1 # Fix for BSD and FreeBSD systems + #fi + +-echo "`date +'%y%m%d %H:%M:%S mysqld started'`" >> $err_log ++datemsg "mysqld started" + while true + do + rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety +@@ -249,7 +255,7 @@ do + # The only thing is ps x => redhat 5 gives warnings when using ps -x. + # kill -9 is used or the process won't react on the kill. + numofproces=`ps xa | grep -v "grep" | grep -c $ledir/$MYSQLD` +- echo -e "\nNumber of processes running now: $numofproces" | tee -a $err_log ++ datemsg "Number of processes running now: $numofproces" + I=1 + while test "$I" -le "$numofproces" + do +@@ -261,7 +267,7 @@ do + # echo "TEST $I - $T **" + if kill -9 $T + then +- echo "$MYSQLD process hanging, pid $T - killed" | tee -a $err_log ++ datemsg "$MYSQLD process hanging, pid $T - killed" + else + break + fi +@@ -269,8 +275,7 @@ do + done + fi + +- echo "`date +'%y%m%d %H:%M:%S mysqld restarted'`" | tee -a $err_log ++ datemsg "mysqld restarted" + done + +-echo "`date +'%y%m%d %H:%M:%S mysqld ended'`" | tee -a $err_log +-echo "" | tee -a $err_log ++datemsg "mysqld ended" |