SF.net SVN: gar:[23951] csw/mgar/pkg/mysql5/branches/mysql-5.6.x

lblume at users.sourceforge.net lblume at users.sourceforge.net
Sat Aug 9 14:22:52 CEST 2014


Revision: 23951
          http://sourceforge.net/p/gar/code/23951
Author:   lblume
Date:     2014-08-09 12:22:48 +0000 (Sat, 09 Aug 2014)
Log Message:
-----------
mysql5/branches/mysql-5.6.x: Bump to 5.6.20; add subversion to the suffix; switch to GCC4

Modified Paths:
--------------
    csw/mgar/pkg/mysql5/branches/mysql-5.6.x/Makefile
    csw/mgar/pkg/mysql5/branches/mysql-5.6.x/checksums

Added Paths:
-----------
    csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql56.postinstall
    csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql56.preinstall
    csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql56.tpl

Removed Paths:
-------------
    csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.postinstall
    csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.preinstall
    csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql5.tpl

Modified: csw/mgar/pkg/mysql5/branches/mysql-5.6.x/Makefile
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.6.x/Makefile	2014-08-09 09:16:14 UTC (rev 23950)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.6.x/Makefile	2014-08-09 12:22:48 UTC (rev 23951)
@@ -10,16 +10,17 @@
 # http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide
 #
 # !!WARNING!!
-# From 5.6.4, stlport is used by default.
+# From 5.6.4, stlport is used by default with Solaris Studio.
+# It should not affect GCC4.
 # It appears to not be used by libmysql*, so there should not be any binary
 # incompatibility there. However, care must be taken that it does not creep
 # in, either in the lib*.so or in the mysql_config script.
 
 
 PROJ_NAME    = mysql
-NAME         = $(PROJ_NAME)5
+NAME         = $(PROJ_NAME)56
 BASE_VERSION = 5.6
-PATCHLEVEL   = 14
+PATCHLEVEL   = 20
 ALTS_PRIO    = 56
 VERSION = $(BASE_VERSION).$(PATCHLEVEL)
 
@@ -28,7 +29,7 @@
 
 PACKAGING_PLATFORMS = solaris10-sparc solaris10-i386
 
-GARCOMPILER = SOS12U3
+GARCOMPILER = GCC4
 
 # Solaris 10 needs a special map file since we need libnsl Version 1.9.1
 # and libc 1.22.5
@@ -43,27 +44,36 @@
   (Structured Query Language) database server.
 endef
 
-# Those options follow those of the official builds
-EXTRA_CFLAGS-sparc = -Xa -xstrconst 
-EXTRA_CFLAGS-i386  = -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -xlibmil -xlibmopt
-EXTRA_CXXFLAGS-sparc = -noex 
-EXTRA_CXXFLAGS-i386  = -fsimple=1 -ftrap=%none -nofstore -xbuiltin=%all -features=no%except -xlibmil -xlibmopt
-EXTRA_CFLAGS   += $(EXTRA_CFLAGS-$(GARCH)) -g -mt -KPIC -DDBUG_OFF -DHAVE_OPENSSL -DMULTI_THREADED -lm -xnorunpath
-EXTRA_CXXFLAGS += $(EXTRA_CXXFLAGS-$(GARCH)) -g0 -mt -KPIC -DDBUG_OFF -DHAVE_OPENSSL -DMULTI_THREADED -lm -norunpath
-EXTRA_LDFLAGS += -Bdirect
+# Comes from the MySQL5.5 recipe, though only one compiler will be kept in 5.6
+### For GCC4
+EXTRA_CFLAGS_GCC4_sparc += -mno-app-regs
 
-# The official build used -xO2 on 32 bit x86, -xO3 for 64 bit
-# Use that for all builds
-OPT_FLAGS_SOS-32 = -xO2
-OPT_FLAGS_SOS-64 = -xO3
-OPT_FLAGS_SOS = $(OPT_FLAGS_SOS-$(MEMORYMODEL))
+EXTRA_CFLAGS_GCC4 += -pthread -fPIC -DPIC -DDBUG_OFF -DHAVE_OPENSSL -DMULTI_THREADED -lm $(EXTRA_CFLAGS_GCC4_$(GARCH))
+EXTRA_CXXFLAGS_GCC4 += -pthread -fPIC -DPIC -DDBUG_OFF -DHAVE_OPENSSL -DMULTI_THREADED -lm $(EXTRA_CXXFLAGS_GCC4_$(MEMORYMODEL))
 
+###
+EXTRA_CFLAGS = $(EXTRA_CFLAGS_$(GARCOMPILER))
+###
 
+EXTRA_LINKER_FLAGS = -lm
+
+OPT_FLAGS_GCC4_32 = -O3
+OPT_FLAGS_GCC4_64 = -O3
+OPT_FLAGS_GCC4 += $(OPT_FLAGS_GCC4_$(MEMORYMODEL)) $(OPT_FLAGS_GCC4_$(GARCH)_$(MEMORYMODEL)) $(OPT_FLAGS_GCC4_$(ISA))
+
 INITSMF = $(sysconfdir)/init\.d/csw$(NAME)
 
 MYSQL_LIB_VER = 18
 
-MERGE_DIRS_isa-extra = $(bindir) $(libdir) $(sbindir) $(libexecdir)
+# The daemon to launch is selected by script, should not be automatic
+# Some other files too should probably not be isaexec'd
+EXTRA_ISAEXEC_EXCLUDE_FILES  = /opt/csw/libexec/mysqld
+EXTRA_ISAEXEC_EXCLUDE_FILES += /opt/csw/bin/mysql_config
+EXTRA_ISAEXEC_EXCLUDE_FILES += /opt/csw/bin/mysqld_safe
+EXTRA_ISAEXEC_EXCLUDE_FILES += /opt/csw/bin/mysqld_multi
+EXTRA_ISAEXEC_EXCLUDE_FILES += /opt/csw/bin/my_print_defaults
+EXTRA_ISAEXEC_EXCLUDE_FILES += /opt/csw/bin/mysqlaccess
+EXTRA_ISAEXEC_EXCLUDE_FILES += /opt/csw/bin/mysqlaccess.conf
 
 PACKAGES += CSWmysql-dev
 SPKG_DESC_CSWmysql-dev = MySQL development files
@@ -84,11 +94,6 @@
 RUNTIME_DEP_PKGS_CSWlibmysqlclient$(MYSQL_LIB_VER) += CSWlibz1
 RUNTIME_DEP_PKGS_CSWlibmysqlclient$(MYSQL_LIB_VER) += CSWlibssl1-0-0
 
-PACKAGES += CSWlibmysqlclient-r$(MYSQL_LIB_VER)
-PKGFILES_CSWlibmysqlclient-r$(MYSQL_LIB_VER) += $(call baseisadirs,$(libdir),libmysqlclient_r\.so\.$(MYSQL_LIB_VER)(\.\d+)*)
-SPKG_DESC_CSWlibmysqlclient-r$(MYSQL_LIB_VER) += MySQL $(BASE_VERSION) client library, libmysqlclient_r.so.$(MYSQL_LIB_VER)
-RUNTIME_DEP_PKGS_CSWlibmysqlclient-r18 += CSWlibmysqlclient18
-
 # Defining the client programs, which are going to pick up the 32- and 64-bit
 # binaries, symbolic links, isaexec stuff and man pages.
 client_programs += myisamlog
@@ -108,7 +113,6 @@
 client_programs += perror
 client_programs += replace
 
-ISAEXEC_CSW$(NAME)client = 1
 PACKAGES += CSW$(NAME)client
 SPKG_DESC_CSW$(NAME)client = MySQL $(BASE_VERSION) client binaries
 PKGFILES_CSW$(NAME)client  = $(bindir)
@@ -126,13 +130,13 @@
 SPKG_DESC_CSW$(NAME) = Multithreaded SQL database
 RUNTIME_DEP_PKGS_CSW$(NAME) += CSW$(NAME)client
 RUNTIME_DEP_PKGS_CSW$(NAME) += CSWlibz1
-RUNTIME_DEP_PKGS_CSW$(NAME) += CSWlibstlport1
 RUNTIME_DEP_PKGS_CSW$(NAME) += CSWlibssl1-0-0
 CHECKPKG_OVERRIDES_CSW$(NAME) += bad-rpath-entry
 CHECKPKG_OVERRIDES_CSW$(NAME) += file-with-bad-content
 CHECKPKG_OVERRIDES_CSW$(NAME) += no-direct-binding|/opt/csw/libexec/mysqld|is|not|directly|bound|to|soname|libmtmalloc.so.1
 CHECKPKG_OVERRIDES_CSW$(NAME) += no-direct-binding|/opt/csw/libexec/sparcv9/mysqld|is|not|directly|bound|to|soname|libmtmalloc.so.1
 CHECKPKG_OVERRIDES_CSW$(NAME) += no-direct-binding|/opt/csw/libexec/amd64/mysqld|is|not|directly|bound|to|soname|libmtmalloc.so.1
+INCOMPATIBLE_PKGS_CSW$(NAME) = CSWmysql5
 
 # An example:
 # s9_preload.so.1|is|needed|by|/opt/csw/bin/innochecksum|but|never|used
@@ -143,6 +147,7 @@
 EXTRA_MERGE_EXCLUDE_FILES += $(datadir)/mysql-test.*
 
 BUILD64 = 1
+ISAEXEC = 1
 
 MASTER_SITES  = http://ftp.heanet.ie/mirrors/www.mysql.com/Downloads/MySQL-$(BASE_VERSION)/
 MASTER_SITES += http://mysql.skynet.be/Downloads/MySQL-$(BASE_VERSION)/
@@ -168,6 +173,7 @@
 CMAKE_ARGS += -DMYSQL_DATADIR=$(localstatedir)/$(NAME)
 CMAKE_ARGS += -DSYSCONFDIR=$(sysconfdir)
 CMAKE_ARGS += -DINSTALL_BINDIR=$(subst $(prefix)/,,$(bindir))
+CMAKE_ARGS += -DINSTALL_SCRIPTDIR=$(subst $(prefix)/,,$(bindir))
 CMAKE_ARGS += -DINSTALL_SBINDIR=$(subst $(prefix)/,,$(libexecdir))
 CMAKE_ARGS += -DINSTALL_LIBDIR=$(subst $(prefix)/,,$(libdir))
 CMAKE_ARGS += -DINSTALL_PLUGINDIR=$(subst $(prefix)/,,$(libdir))/$(NAME)/plugin
@@ -176,7 +182,6 @@
 CMAKE_ARGS += -DINSTALL_INFODIR=$(subst $(prefix)/,,$(infodir))/$(NAME)
 CMAKE_ARGS += -DINSTALL_MYSQLSHAREDIR=$(subst $(prefix)/,,$(sharedstatedir))/$(NAME)
 CMAKE_ARGS += -DINSTALL_SUPPORTFILESDIR=$(subst $(prefix)/,,$(sharedstatedir))/$(NAME)/support-files
-CMAKE_ARGS += -DWITH_LIBWRAP=1
 CMAKE_ARGS += -DWITH_SSL=system
 CMAKE_ARGS += -DWITH_ZLIB=system
 CMAKE_ARGS += -DDEFAULT_CHARSET=utf8
@@ -184,8 +189,8 @@
 CMAKE_ARGS += -DCOMPILATION_COMMENT='OpenCSW'
 CMAKE_ARGS += -DBUILD_CONFIG=mysql_release
 CMAKE_ARGS += -DOPENSSL_ROOT_DIR=$(prefix)
-CMAKE_ARGS += -DC_FLAGS="$(CFLAGS)"
-CMAKE_ARGS += -DCXX_FLAGS="$(CXXFLAGS)"
+CMAKE_ARGS += -DCMAKE_C_FLAGS="$(CFLAGS)"
+CMAKE_ARGS += -DCMAKE_CXX_FLAGS="$(CXXFLAGS)"
 CMAKE_ARGS += -DCMAKE_C_LINK_FLAGS="$(LDFLAGS)"
 CMAKE_ARGS += -DCMAKE_CXX_LINK_FLAGS="$(LDFLAGS)"
 CMAKE_ARGS += -DCMAKE_LIBRARY_PATH="$(libdir)"
@@ -222,7 +227,6 @@
 CMAKE_ARGS += "-DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON"
 CMAKE_ARGS += "-DWITH_PERFSCHEMA_STORAGE_ENGINE:BOOL=ON"
 CMAKE_ARGS += "-DWITH_PIC:BOOL=ON"
-CMAKE_ARGS += "-DWITH_READLINE:BOOL=ON"
 CMAKE_ARGS += "-DWITH_UNIT_TESTS:BOOL=ON"
 CMAKE_ARGS += "-DWITH_VALGRIND:BOOL=OFF"
 CMAKE_ARGS += "-DENABLE_DTRACE:BOOL=ON"
@@ -315,12 +319,41 @@
 post-install-modulated:
 	ginstall -m 755 -d $(DESTDIR)$(sysconfdir)/init.d
 	ginstall -m 755 $(WORKDIR)/csw$(NAME) $(DESTDIR)$(sysconfdir)/init.d
-	(cd $(DESTDIR)$(libdir); rm libmysqlclient_r.so.18; \
-		ln -s libmysqlclient.so.18 libmysqlclient_r.so.18)
-	(cd $(DESTDIR)$(libdir); rm libmysqlclient_r.so.18.0.0; \
-		ln -s libmysqlclient.so.18.0.0 libmysqlclient_r.so.18.0.0)
-	# Do not distribute libstlport with MySQL, use a separate one
-	(cd $(DESTDIR)$(libdir); rm libstlport.*)
+	# Make sure the proper binary is called by the script since
+	# mgar does the configure part using only the base arch name, w/o
+	# the special instructions part
+	# Only needed for 64 bit
+	if [ "$(MEMORYMODEL)" = 64 ]; then \
+		for file in mysqld_safe mysqld_multi; do \
+			perl -pi \
+				-e 'if (/^[^#]/) { s|/bin(?!/$(ISABINDIR))|/bin/$(ISABINDIR)|g }' \
+				-e 'if (/^[^#]/) { s|/sbin(?!/$(ISABINDIR))|/sbin/$(ISABINDIR)|g }' \
+				-e 'if (/^[^#]/) { s|/libexec(?!/$(ISABINDIR))|/libexec/$(ISABINDIR)|g }' \
+				$(DESTDIR)$(bindir)/$$file; \
+		done; \
+	fi
+
+	# Remove compiler-specific parameters
+	gsed -i \
+		-e '/^[^#]/s/-xO[0-5][^ ]* *//g' \
+		-e '/^[^#]/s/-xarch=[^ ]* *//g' \
+		-e '/^[^#]/s/-xchip=[^ ]* *//g' \
+		-e '/^[^#]/s/-norunpath[^ ]* *//g' \
+		-e '/^[^#]/s/-lCrun[^ ]* *//g' \
+		-e '/^[^#]/s/-lCstd[^ ]* *//g' \
+		-e '/^[^#]/s/-mtune=[^ ]* *//g' \
+		-e '/^[^#]/s/-march=[^ ]* *//g' \
+		-e '/^[^#]/s/-Wall *//g' \
+		-e '/^[^#]/s/-pipe *//g' \
+		-e '/^[^#]/s/-KPIC/-fPIC/g' \
+		-e '/^[^#]/s/-mno-app-regs//g' \
+		-e '/^[^#]/s/-fno-omit-frame-pointer//g' \
+		-e '/^[^#]/s/-fno-strict-aliasing//g' \
+		-e '/^[^#]/s/-Wa[^ ]*//g' \
+		-e '/^[^#]/s/-static-libgcc//g' \
+		-e '/^[^#]/s/-pthread//g' \
+		$(DESTDIR)$(bindir)/mysql_config
+
 	@$(MAKECOOKIE)
 
 post-merge:

Modified: csw/mgar/pkg/mysql5/branches/mysql-5.6.x/checksums
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.6.x/checksums	2014-08-09 09:16:14 UTC (rev 23950)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.6.x/checksums	2014-08-09 12:22:48 UTC (rev 23951)
@@ -1 +1 @@
-52224ce51dbf6ffbcef82be30688cc04  mysql-5.6.14.tar.gz
+71ed71ecc53222a2f03523cd13cf2141  mysql-5.6.20.tar.gz

Deleted: csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.postinstall
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.postinstall	2014-08-09 09:16:14 UTC (rev 23950)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.postinstall	2014-08-09 12:22:48 UTC (rev 23951)
@@ -1,93 +0,0 @@
-#!/bin/ksh -p
-#
-# $Id$
-#
-# initial version for blastwave.org by Alex Moore 2006.02.25
-# Revised 2006.03.25 - see bug report 0001542
-#
-# This script creates a default database with the small-memory footprint.
-# Input may be provided for DATADIR and DEFAULTS_FILE
-#
-# http://dev.mysql.com/doc/refman/5.0/en/option-files.html
-#
-prefix="/opt/csw"
-BASEDIR="${prefix}"
-MYSQL_HOME="/var${prefix}/mysql5"
-sysconfdir="/etc${prefix}"
-# https://www.opencsw.org/mantis/view.php?id=4646
-DEFAULTS_FILE="${prefix}/share/mysql5/support-files/my-small.cnf
-MYSQLD_USER="mysql"
-MYSQLD_GROUP="mysql"
-# Provide the default data directory
-MYSQLD_DATADIR="${MYSQL_HOME}"
-DEPRECATED_DEFAULTS_FILE="${BASEDIR}/my.cnf"
-
-# http://bugs.mysql.com/bug.php?id=31164
-# ERROR: 1004  Can't create file '/var/tmp//installRJaiQ3/#sql6fee_1_0.frm' (errno: 13)
-unset TMPDIR
-
-if [ -r "${DEPRECATED_DEFAULTS_FILE}" ]; then
-  echo "*** WARNING ***"
-  echo "File '${DEPRECATED_DEFAULTS_FILE}' found. This location is deprecated."
-  echo "This file takes no effect."
-fi
-
-if [ ! -f "$DEFAULTS_FILE" ]; then
-    IN_DEFAULTS_FILE=$BASEDIR/share/mysql5/support-files/my-small.cnf
-    echo "Using $IN_DEFAULTS_FILE to create the options file."
-else
-    IN_DEFAULTS_FILE=$DEFAULTS_FILE
-    echo "Using $DEFAULTS_FILE as the options file."
-fi
-
-if [ -d "$MYSQLD_DATADIR/mysql" ]; then
-    echo "mysql database already exists."
-    echo "Leaving script without initializing a database."
-    exit 0
-fi
-
-echo  "Setting up the database"
-# Create the database directory and set the permissions if needed
-if [ ! -d "$MYSQLD_DATADIR" ] ; then
-    mkdir -p $MYSQLD_DATADIR
-    chown -R ${MYSQLD_USER}:${MYSQLD_GROUP} $MYSQLD_DATADIR
-    chmod 0700 $MYSQLD_DATADIR
-fi
-#
-# copy the configuration file if not exists.
-CNFCOPIED=no
-if [ ! -f "$DEFAULTS_FILE" ] ; then
-    cp -p $IN_DEFAULTS_FILE $DEFAULTS_FILE
-    CNFCOPIED=yes
-fi
-#
-# Run the mysql script to create the database
-echo "Creating MySQL core database in $MYSQLD_DATADIR"
-echo
-echo "###  The following messages are from mysql_install_db."
-"$BASEDIR/bin/mysql_install_db" \
-    --defaults-extra-file="$DEFAULTS_FILE" \
-    --user="$MYSQLD_USER" \
-    --basedir="$BASEDIR" \
-    --datadir="$MYSQLD_DATADIR"
-
-# Fix permissions on the data directory, since mysql_install_db was run as
-# root.
-chown -R ${MYSQLD_USER}:${MYSQLD_GROUP} $MYSQLD_DATADIR
-
-# Update --datadir in the cnf file with the correct value if file was copied
-if [ x"$CNFCOPIED" = xyes ]; then
-    sed -e "s|/var/opt/csw/mysql5|$MYSQLD_DATADIR|g" $DEFAULTS_FILE >$DEFAULTS_FILE.new
-    mv $DEFAULTS_FILE.new $DEFAULTS_FILE
-fi
-
-# Ending message
-echo
-echo "###  The following messages are from $0."
-echo "See ${prefix}/share/doc/mysql5/README.CSW for packaging changes."
-echo "Please ignore references to starting mysqld_safe in the messages above."
-echo "  These messages are from mysql_install_db."
-
-exit 0
-
-# vim:set ts=2 sw=2 sts=2 expandtab:

Deleted: csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.preinstall
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.preinstall	2014-08-09 09:16:14 UTC (rev 23950)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.preinstall	2014-08-09 12:22:48 UTC (rev 23951)
@@ -1,40 +0,0 @@
-#!/bin/sh
-# vim:set sw=2 ts=2 sts=2 expandtab:
-#
-# $Id$
-#
-
-obsolete_directories="/opt/csw/mysql5/var:/var/opt/csw/mysql5"
-
-obsolete_dir_information="
-This directory is obsolete.  Files in this directory are going to be ignored.
-Please move your data to the new location.
-
-Feel free to remove this file afterwards.
-"
-obsolete_dir_file_name="README.THIS_DIRECTORY_IS_OBSOLETE"
-
-for dirpair in ${obsolete_directories}; do
-  obsolete_dir=`echo ${dirpair} | cut -d: -f1`
-  new_dir=`echo ${dirpair} | cut -d: -f2`
-  if [ -d "${PKG_INSTALL_ROOT}${obsolete_dir}" ]; then
-    echo
-    echo "*******************************************************************"
-    echo "* The old configuration directory ${obsolete_dir} still exists.    "
-    echo "* Please move your configuration to ${new_dir}.                    "
-    echo "*                                                                  "
-    echo "*       Installation will continue in 10 seconds.                  "
-    echo "*         Press CTRL+C if you want to stop now.                    "
-    echo "*******************************************************************"
-    echo
-    sleep 10
-
-    # Leaving a note for the sysadmin if the they proceed with the installation.
-    fn="${PKG_INSTALL_ROOT}${obsolete_dir}/${obsolete_dir_file_name}"
-    if touch "${fn}" 2>/dev/null; then
-      echo "${obsolete_dir_information}" > "${fn}"
-    fi
-  fi
-done
-
-exit 0

Copied: csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql56.postinstall (from rev 23950, csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.postinstall)
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql56.postinstall	                        (rev 0)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql56.postinstall	2014-08-09 12:22:48 UTC (rev 23951)
@@ -0,0 +1,93 @@
+#!/bin/ksh -p
+#
+# $Id$
+#
+# initial version for blastwave.org by Alex Moore 2006.02.25
+# Revised 2006.03.25 - see bug report 0001542
+#
+# This script creates a default database with the small-memory footprint.
+# Input may be provided for DATADIR and DEFAULTS_FILE
+#
+# http://dev.mysql.com/doc/refman/5.0/en/option-files.html
+#
+prefix="/opt/csw"
+BASEDIR="${prefix}"
+MYSQL_HOME="/var${prefix}/mysql5"
+sysconfdir="/etc${prefix}"
+# https://www.opencsw.org/mantis/view.php?id=4646
+DEFAULTS_FILE="${prefix}/share/mysql5/support-files/my-small.cnf
+MYSQLD_USER="mysql"
+MYSQLD_GROUP="mysql"
+# Provide the default data directory
+MYSQLD_DATADIR="${MYSQL_HOME}"
+DEPRECATED_DEFAULTS_FILE="${BASEDIR}/my.cnf"
+
+# http://bugs.mysql.com/bug.php?id=31164
+# ERROR: 1004  Can't create file '/var/tmp//installRJaiQ3/#sql6fee_1_0.frm' (errno: 13)
+unset TMPDIR
+
+if [ -r "${DEPRECATED_DEFAULTS_FILE}" ]; then
+  echo "*** WARNING ***"
+  echo "File '${DEPRECATED_DEFAULTS_FILE}' found. This location is deprecated."
+  echo "This file takes no effect."
+fi
+
+if [ ! -f "$DEFAULTS_FILE" ]; then
+    IN_DEFAULTS_FILE=$BASEDIR/share/mysql5/support-files/my-small.cnf
+    echo "Using $IN_DEFAULTS_FILE to create the options file."
+else
+    IN_DEFAULTS_FILE=$DEFAULTS_FILE
+    echo "Using $DEFAULTS_FILE as the options file."
+fi
+
+if [ -d "$MYSQLD_DATADIR/mysql" ]; then
+    echo "mysql database already exists."
+    echo "Leaving script without initializing a database."
+    exit 0
+fi
+
+echo  "Setting up the database"
+# Create the database directory and set the permissions if needed
+if [ ! -d "$MYSQLD_DATADIR" ] ; then
+    mkdir -p $MYSQLD_DATADIR
+    chown -R ${MYSQLD_USER}:${MYSQLD_GROUP} $MYSQLD_DATADIR
+    chmod 0700 $MYSQLD_DATADIR
+fi
+#
+# copy the configuration file if not exists.
+CNFCOPIED=no
+if [ ! -f "$DEFAULTS_FILE" ] ; then
+    cp -p $IN_DEFAULTS_FILE $DEFAULTS_FILE
+    CNFCOPIED=yes
+fi
+#
+# Run the mysql script to create the database
+echo "Creating MySQL core database in $MYSQLD_DATADIR"
+echo
+echo "###  The following messages are from mysql_install_db."
+"$BASEDIR/bin/mysql_install_db" \
+    --defaults-extra-file="$DEFAULTS_FILE" \
+    --user="$MYSQLD_USER" \
+    --basedir="$BASEDIR" \
+    --datadir="$MYSQLD_DATADIR"
+
+# Fix permissions on the data directory, since mysql_install_db was run as
+# root.
+chown -R ${MYSQLD_USER}:${MYSQLD_GROUP} $MYSQLD_DATADIR
+
+# Update --datadir in the cnf file with the correct value if file was copied
+if [ x"$CNFCOPIED" = xyes ]; then
+    sed -e "s|/var/opt/csw/mysql5|$MYSQLD_DATADIR|g" $DEFAULTS_FILE >$DEFAULTS_FILE.new
+    mv $DEFAULTS_FILE.new $DEFAULTS_FILE
+fi
+
+# Ending message
+echo
+echo "###  The following messages are from $0."
+echo "See ${prefix}/share/doc/mysql5/README.CSW for packaging changes."
+echo "Please ignore references to starting mysqld_safe in the messages above."
+echo "  These messages are from mysql_install_db."
+
+exit 0
+
+# vim:set ts=2 sw=2 sts=2 expandtab:

Copied: csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql56.preinstall (from rev 23950, csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql5.preinstall)
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql56.preinstall	                        (rev 0)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/CSWmysql56.preinstall	2014-08-09 12:22:48 UTC (rev 23951)
@@ -0,0 +1,40 @@
+#!/bin/sh
+# vim:set sw=2 ts=2 sts=2 expandtab:
+#
+# $Id$
+#
+
+obsolete_directories="/opt/csw/mysql5/var:/var/opt/csw/mysql5"
+
+obsolete_dir_information="
+This directory is obsolete.  Files in this directory are going to be ignored.
+Please move your data to the new location.
+
+Feel free to remove this file afterwards.
+"
+obsolete_dir_file_name="README.THIS_DIRECTORY_IS_OBSOLETE"
+
+for dirpair in ${obsolete_directories}; do
+  obsolete_dir=`echo ${dirpair} | cut -d: -f1`
+  new_dir=`echo ${dirpair} | cut -d: -f2`
+  if [ -d "${PKG_INSTALL_ROOT}${obsolete_dir}" ]; then
+    echo
+    echo "*******************************************************************"
+    echo "* The old configuration directory ${obsolete_dir} still exists.    "
+    echo "* Please move your configuration to ${new_dir}.                    "
+    echo "*                                                                  "
+    echo "*       Installation will continue in 10 seconds.                  "
+    echo "*         Press CTRL+C if you want to stop now.                    "
+    echo "*******************************************************************"
+    echo
+    sleep 10
+
+    # Leaving a note for the sysadmin if the they proceed with the installation.
+    fn="${PKG_INSTALL_ROOT}${obsolete_dir}/${obsolete_dir_file_name}"
+    if touch "${fn}" 2>/dev/null; then
+      echo "${obsolete_dir_information}" > "${fn}"
+    fi
+  fi
+done
+
+exit 0

Deleted: csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql5.tpl
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql5.tpl	2014-08-09 09:16:14 UTC (rev 23950)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql5.tpl	2014-08-09 12:22:48 UTC (rev 23951)
@@ -1,424 +0,0 @@
-#!/bin/sh
-# vim:ft=sh:
-#
-# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
-# This file is public domain and comes with NO WARRANTY of any kind
-
-# MySQL daemon start/stop script.
-
-# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
-# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
-# When this is done the mysql server will be started when the machine is
-# started and shut down when the systems goes down.
-
-# Comments for OpenCSW's CAS scripts
-#RC_KNUM 01
-#RC_SNUM 99
-#RC_KLEV 0,1,2,S
-#RC_SLEV 3
-#FMRI network
-#AUTOENABLE no
-
-# If you install MySQL on some other places than @prefix@, then you
-# have to do one of the following things for this script to work:
-#
-# - Run this script from within the MySQL installation directory
-# - Create a @sysconfdir@/my.cnf file with the following information:
-#   [mysqld]
-#   basedir=<path-to-mysql-installation-directory>
-# - Add the above to any other configuration file (for example ~/.my.ini)
-#   and copy my_print_defaults to /usr/bin
-# - Add the path to the mysql-installation-directory to the basedir variable
-#   below.
-#
-# If you want to affect other MySQL variables, you should make your changes
-# in the @sysconfdir@/my.cnf, ~/.my.cnf or other MySQL configuration files.
-
-# If you change base dir, you must also change datadir. These may get
-# overwritten by settings in the MySQL configuration files.
-
-basedir=
-datadir=
-
-# Default value, in seconds, afterwhich the script should timeout waiting
-# for server start.
-# Value here is overriden by value in my.cnf.
-# 0 means don't wait at all
-# Negative numbers mean to wait indefinitely
-service_startup_timeout=900
-
-# Lock directory for RedHat / SuSE.
-lockdir='/var/lock/subsys'
-lock_file_path="$lockdir/mysql"
-
-# The following variables are only set for letting mysql.server find things.
-
-# Set some defaults
-mysqld_pid_file_path=
-if test -z "$basedir"
-then
-  basedir=@prefix@
-  bindir=@bindir@
-  if test -z "$datadir"
-  then
-    datadir=@localstatedir@
-  fi
-  sbindir=@prefix@/libexec
-  libexecdir=@prefix@/libexec
-else
-  bindir="$basedir/bin"
-  if test -z "$datadir"
-  then
-    datadir="$basedir/data"
-  fi
-  sbindir="$basedir/libexec"
-  libexecdir="$basedir/libexec"
-fi
-
-# datadir_set is used to determine if datadir was set (and so should be
-# *not* set inside of the --basedir= handler.)
-datadir_set=
-
-#
-# Use LSB init script functions for printing messages, if possible
-#
-lsb_functions="/lib/lsb/init-functions"
-if test -f $lsb_functions ; then
-  . $lsb_functions
-else
-  log_success_msg()
-  {
-    echo " SUCCESS! $@"
-  }
-  log_failure_msg()
-  {
-    echo " ERROR! $@"
-  }
-fi
-
-PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
-export PATH
-
-mode=$1    # start or stop
-
-[ $# -ge 1 ] && shift
-
-
-other_args="$*"   # uncommon, but needed when called from an RPM upgrade action
-           # Expected: "--skip-networking --skip-grant-tables"
-           # They are not checked here, intentionally, as it is the resposibility
-           # of the "spec" file author to give correct arguments only.
-
-case `echo "testing\c"`,`echo -n testing` in
-    *c*,-n*) echo_n=   echo_c=     ;;
-    *c*,*)   echo_n=-n echo_c=     ;;
-    *)       echo_n=   echo_c='\c' ;;
-esac
-
-parse_server_arguments() {
-  for arg do
-    case "$arg" in
-      # $mysql5_arch must have been set (or left empty) for Solaris
-      # by the OpenCSW architecture selection bit
-      --basedir=*)  basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
-                    bindir="$basedir/bin/$mysql5_arch"
-		    if test -z "$datadir_set"; then
-		      datadir="$basedir/data"
-		    fi
-		    sbindir="$basedir/sbin/$mysql5_arch"
-		    libexecdir="$basedir/libexec/$mysql5_arch"
-        ;;
-      --datadir=*)  datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
-		    datadir_set=1
-	;;
-      --pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
-      --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
-    esac
-  done
-}
-
-wait_for_pid () {
-  verb="$1"           # created | removed
-  pid="$2"            # process ID of the program operating on the pid-file
-  pid_file_path="$3" # path to the PID file.
-
-  i=0
-  avoid_race_condition="by checking again"
-
-  while test $i -ne $service_startup_timeout ; do
-
-    case "$verb" in
-      'created')
-        # wait for a PID-file to pop into existence.
-        test -s "$pid_file_path" && i='' && break
-        ;;
-      'removed')
-        # wait for this PID-file to disappear
-        test ! -s "$pid_file_path" && i='' && break
-        ;;
-      *)
-        echo "wait_for_pid () usage: wait_for_pid created|removed pid pid_file_path"
-        exit 1
-        ;;
-    esac
-
-    # if server isn't running, then pid-file will never be updated
-    if test -n "$pid"; then
-      if kill -0 "$pid" 2>/dev/null; then
-        :  # the server still runs
-      else
-        # The server may have exited between the last pid-file check and now.
-        if test -n "$avoid_race_condition"; then
-          avoid_race_condition=""
-          continue  # Check again.
-        fi
-
-        # there's nothing that will affect the file.
-        log_failure_msg "The server quit without updating PID file ($pid_file_path)."
-        return 1  # not waiting any more.
-      fi
-    fi
-
-    echo $echo_n ".$echo_c"
-    i=`expr $i + 1`
-    sleep 1
-
-  done
-
-  if test -z "$i" ; then
-    log_success_msg
-    return 0
-  else
-    log_failure_msg
-    return 1
-  fi
-}
-
-### START OPENCSW ARCHITECTURE SELECTION
-# Source the configuration
-# This is used to define the binary architeture to run
-
-# Check the old location first
-[ -r @prefix@/etc/csw.conf ] && . @prefix@/etc/csw.conf
-
-# Check the current location, its content overrides the previous one
-[ -r @sysconfdir@/csw.conf ] && . @sysconfdir@/csw.conf
-
-# If the package-specific variable is not set, try the default
-if [ -z "$mysql5_arch" ]; then
-  if [ -n "$default_arch" ]; then
-    mysql5_arch="$default_arch"
-  fi
-else
-  # In that specific case, by default, there is no subdir
-  if [ "$mysql5_arch" = "i386" -o "$mysql5_arch" = "sparc" ]; then
-    mysql5_arch=""
-  fi
-fi
-
-# If a value was found
-if [ -n "$mysql5_arch" ]; then
-  if [ "$mysql5_arch" = "kernel" ]; then
-    # Use the system's default arch
-    mysql5_arch=`isainfo -k`
-  fi
-
-  # Add the architecture suffix to the executables' directories, if it exists
-  # The binaries themselves are tested below, so the script should fail
-  # mostly gracefully if a non-present arch is set up.
-  if [ -d "$bindir/$mysql5_arch" -a \
-       -d "$sbindir/$mysql5_arch" -a \
-       -d "$libexecdir/$mysql5_arch" ]; then
-    bindir="$bindir/$mysql5_arch"
-    sbindir="$sbindir/$mysql5_arch"
-    libexecdir="$libexecdir/$mysql5_arch"
-  fi
-fi
-### END OPENCSW ARCHITECTURE SELECTION
-
-# Get arguments from the my.cnf file,
-# the only group, which is read from now on is [mysqld]
-if test -x ./bin/my_print_defaults
-then
-  print_defaults="./bin/my_print_defaults"
-elif test -x $bindir/my_print_defaults
-then
-  print_defaults="$bindir/my_print_defaults"
-elif test -x $bindir/mysql_print_defaults
-then
-  print_defaults="$bindir/mysql_print_defaults"
-else
-  # Try to find basedir in @sysconfdir@/my.cnf
-  conf=@sysconfdir@/my.cnf
-  print_defaults=
-  if test -r $conf
-  then
-    subpat='^[^=]*basedir[^=]*=\(.*\)$'
-    dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
-    for d in $dirs
-    do
-      d=`echo $d | sed -e 's/[ 	]//g'`
-      if test -x "$d/bin/my_print_defaults"
-      then
-        print_defaults="$d/bin/my_print_defaults"
-        break
-      fi
-      if test -x "$d/bin/mysql_print_defaults"
-      then
-        print_defaults="$d/bin/mysql_print_defaults"
-        break
-      fi
-    done
-  fi
-
-  # Hope it's in the PATH ... but I doubt it
-  test -z "$print_defaults" && print_defaults="my_print_defaults"
-fi
-
-#
-# Read defaults file from 'basedir'.   If there is no defaults file there
-# check if it's in the old (depricated) place (datadir) and read it from there
-#
-
-extra_args=""
-if test -r "$basedir/my.cnf"
-then
-  extra_args="-e $basedir/my.cnf"
-else
-  if test -r "$datadir/my.cnf"
-  then
-    extra_args="-e $datadir/my.cnf"
-  fi
-fi
-
-parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
-
-#
-# Set pid file if not given
-#
-if test -z "$mysqld_pid_file_path"
-then
-  mysqld_pid_file_path=$datadir/`hostname`.pid
-else
-  case "$mysqld_pid_file_path" in
-    /* ) ;;
-    * )  mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;;
-  esac
-fi
-
-case "$mode" in
-  'start')
-    # Start daemon
-
-    # Safeguard (relative paths, core dumps..)
-    # Changed to /opt for OpenCSW to avoid mysqld_safe picking the 32 bit
-    # binary in libexec/
-    cd /opt
-
-    echo $echo_n "Starting MySQL"
-    if test -x $bindir/mysqld_safe
-    then
-      # Give extra arguments to mysqld with the my.cnf file. This script
-      # may be overwritten at next upgrade.
-      $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
-      wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
-
-      # Make lock for RedHat / SuSE
-      if test -w "$lockdir"
-      then
-        touch "$lock_file_path"
-      fi
-
-      exit $return_value
-    else
-      log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
-    fi
-    ;;
-
-  'stop')
-    # Stop daemon. We use a signal here to avoid having to know the
-    # root password.
-
-    if test -s "$mysqld_pid_file_path"
-    then
-      mysqld_pid=`cat "$mysqld_pid_file_path"`
-
-      if (kill -0 $mysqld_pid 2>/dev/null)
-      then
-        echo $echo_n "Shutting down MySQL"
-        kill $mysqld_pid
-        # mysqld should remove the pid file when it exits, so wait for it.
-        wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
-      else
-        log_failure_msg "MySQL server process #$mysqld_pid is not running!"
-        rm "$mysqld_pid_file_path"
-      fi
-
-      # Delete lock for RedHat / SuSE
-      if test -f "$lock_file_path"
-      then
-        rm -f "$lock_file_path"
-      fi
-      exit $return_value
-    else
-      log_failure_msg "MySQL server PID file could not be found!"
-    fi
-    ;;
-
-  'restart')
-    # Stop the service and regardless of whether it was
-    # running or not, start it again.
-    if $0 stop  $other_args; then
-      $0 start $other_args
-    else
-      log_failure_msg "Failed to stop running server, so refusing to try to start."
-      exit 1
-    fi
-    ;;
-
-  'reload'|'force-reload')
-    if test -s "$mysqld_pid_file_path" ; then
-      read mysqld_pid <  "$mysqld_pid_file_path"
-      kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
-      touch "$mysqld_pid_file_path"
-    else
-      log_failure_msg "MySQL PID file could not be found!"
-      exit 1
-    fi
-    ;;
-  'status')
-    # First, check to see if pid file exists
-    if test -s "$mysqld_pid_file_path" ; then
-      read mysqld_pid < "$mysqld_pid_file_path"
-      if kill -0 $mysqld_pid 2>/dev/null ; then
-        log_success_msg "MySQL running ($mysqld_pid)"
-        exit 0
-      else
-        log_failure_msg "MySQL is not running, but PID file exists"
-        exit 1
-      fi
-    else
-      # Try to find appropriate mysqld process
-      mysqld_pid=`pgrep $libexecdir/mysqld`
-      if test -z "$mysqld_pid" ; then
-        if test -f "$lock_file_path" ; then
-          log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
-          exit 2
-        fi
-        log_failure_msg "MySQL is not running"
-        exit 3
-      else
-        log_failure_msg "MySQL is running but PID file could not be found"
-        exit 4
-      fi
-    fi
-    ;;
-    *)
-      # usage
-      basename=`basename "$0"`
-      echo "Usage: $basename  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]"
-      exit 1
-    ;;
-esac
-
-exit 0

Copied: csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql56.tpl (from rev 23950, csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql5.tpl)
===================================================================
--- csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql56.tpl	                        (rev 0)
+++ csw/mgar/pkg/mysql5/branches/mysql-5.6.x/files/cswmysql56.tpl	2014-08-09 12:22:48 UTC (rev 23951)
@@ -0,0 +1,424 @@
+#!/bin/sh
+# vim:ft=sh:
+#
+# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
+# This file is public domain and comes with NO WARRANTY of any kind
+
+# MySQL daemon start/stop script.
+
+# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
+# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
+# When this is done the mysql server will be started when the machine is
+# started and shut down when the systems goes down.
+
+# Comments for OpenCSW's CAS scripts
+#RC_KNUM 01
+#RC_SNUM 99
+#RC_KLEV 0,1,2,S
+#RC_SLEV 3
+#FMRI network
+#AUTOENABLE no
+
+# If you install MySQL on some other places than @prefix@, then you
+# have to do one of the following things for this script to work:
+#
+# - Run this script from within the MySQL installation directory
+# - Create a @sysconfdir@/my.cnf file with the following information:
+#   [mysqld]
+#   basedir=<path-to-mysql-installation-directory>
+# - Add the above to any other configuration file (for example ~/.my.ini)
+#   and copy my_print_defaults to /usr/bin
+# - Add the path to the mysql-installation-directory to the basedir variable
+#   below.
+#
+# If you want to affect other MySQL variables, you should make your changes
+# in the @sysconfdir@/my.cnf, ~/.my.cnf or other MySQL configuration files.
+
+# If you change base dir, you must also change datadir. These may get
+# overwritten by settings in the MySQL configuration files.
+
+basedir=
+datadir=
+
+# Default value, in seconds, afterwhich the script should timeout waiting
+# for server start.
+# Value here is overriden by value in my.cnf.
+# 0 means don't wait at all
+# Negative numbers mean to wait indefinitely
+service_startup_timeout=900
+
+# Lock directory for RedHat / SuSE.
+lockdir='/var/lock/subsys'
+lock_file_path="$lockdir/mysql"
+
+# The following variables are only set for letting mysql.server find things.
+
+# Set some defaults
+mysqld_pid_file_path=
+if test -z "$basedir"
+then
+  basedir=@prefix@
+  bindir=@bindir@
+  if test -z "$datadir"
+  then
+    datadir=@localstatedir@
+  fi
+  sbindir=@prefix@/libexec
+  libexecdir=@prefix@/libexec
+else
+  bindir="$basedir/bin"
+  if test -z "$datadir"
+  then
+    datadir="$basedir/data"
+  fi
+  sbindir="$basedir/libexec"
+  libexecdir="$basedir/libexec"
+fi
+
+# datadir_set is used to determine if datadir was set (and so should be
+# *not* set inside of the --basedir= handler.)
+datadir_set=
+
+#
+# Use LSB init script functions for printing messages, if possible
+#
+lsb_functions="/lib/lsb/init-functions"
+if test -f $lsb_functions ; then
+  . $lsb_functions
+else
+  log_success_msg()
+  {
+    echo " SUCCESS! $@"
+  }
+  log_failure_msg()
+  {
+    echo " ERROR! $@"
+  }
+fi
+
+PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
+export PATH
+
+mode=$1    # start or stop
+
+[ $# -ge 1 ] && shift
+
+
+other_args="$*"   # uncommon, but needed when called from an RPM upgrade action
+           # Expected: "--skip-networking --skip-grant-tables"
+           # They are not checked here, intentionally, as it is the resposibility
+           # of the "spec" file author to give correct arguments only.
+
+case `echo "testing\c"`,`echo -n testing` in
+    *c*,-n*) echo_n=   echo_c=     ;;
+    *c*,*)   echo_n=-n echo_c=     ;;
+    *)       echo_n=   echo_c='\c' ;;
+esac
+
+parse_server_arguments() {
+  for arg do
+    case "$arg" in
+      # $mysql5_arch must have been set (or left empty) for Solaris
+      # by the OpenCSW architecture selection bit
+      --basedir=*)  basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
+                    bindir="$basedir/bin/$mysql5_arch"
+		    if test -z "$datadir_set"; then
+		      datadir="$basedir/data"
+		    fi
+		    sbindir="$basedir/sbin/$mysql5_arch"
+		    libexecdir="$basedir/libexec/$mysql5_arch"
+        ;;
+      --datadir=*)  datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
+		    datadir_set=1
+	;;
+      --pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+      --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
+    esac
+  done
+}
+
+wait_for_pid () {
+  verb="$1"           # created | removed
+  pid="$2"            # process ID of the program operating on the pid-file
+  pid_file_path="$3" # path to the PID file.
+
+  i=0
+  avoid_race_condition="by checking again"
+
+  while test $i -ne $service_startup_timeout ; do
+
+    case "$verb" in
+      'created')
+        # wait for a PID-file to pop into existence.
+        test -s "$pid_file_path" && i='' && break
+        ;;
+      'removed')
+        # wait for this PID-file to disappear
+        test ! -s "$pid_file_path" && i='' && break
+        ;;
+      *)
+        echo "wait_for_pid () usage: wait_for_pid created|removed pid pid_file_path"
+        exit 1
+        ;;
+    esac
+
+    # if server isn't running, then pid-file will never be updated
+    if test -n "$pid"; then
+      if kill -0 "$pid" 2>/dev/null; then
+        :  # the server still runs
+      else
+        # The server may have exited between the last pid-file check and now.
+        if test -n "$avoid_race_condition"; then
+          avoid_race_condition=""
+          continue  # Check again.
+        fi
+
+        # there's nothing that will affect the file.
+        log_failure_msg "The server quit without updating PID file ($pid_file_path)."
+        return 1  # not waiting any more.
+      fi
+    fi
+
+    echo $echo_n ".$echo_c"
+    i=`expr $i + 1`
+    sleep 1
+
+  done
+
+  if test -z "$i" ; then
+    log_success_msg
+    return 0
+  else
+    log_failure_msg
+    return 1
+  fi
+}
+
+### START OPENCSW ARCHITECTURE SELECTION
+# Source the configuration
+# This is used to define the binary architeture to run
+
+# Check the old location first
+[ -r @prefix@/etc/csw.conf ] && . @prefix@/etc/csw.conf
+
+# Check the current location, its content overrides the previous one
+[ -r @sysconfdir@/csw.conf ] && . @sysconfdir@/csw.conf
+
+# If the package-specific variable is not set, try the default
+if [ -z "$mysql5_arch" ]; then
+  if [ -n "$default_arch" ]; then
+    mysql5_arch="$default_arch"
+  fi
+else
+  # In that specific case, by default, there is no subdir
+  if [ "$mysql5_arch" = "i386" -o "$mysql5_arch" = "sparc" ]; then
+    mysql5_arch=""
+  fi
+fi
+
+# If a value was found
+if [ -n "$mysql5_arch" ]; then
+  if [ "$mysql5_arch" = "kernel" ]; then
+    # Use the system's default arch
+    mysql5_arch=`isainfo -k`
+  fi
+
+  # Add the architecture suffix to the executables' directories, if it exists
+  # The binaries themselves are tested below, so the script should fail
+  # mostly gracefully if a non-present arch is set up.
+  if [ -d "$bindir/$mysql5_arch" -a \
+       -d "$sbindir/$mysql5_arch" -a \
+       -d "$libexecdir/$mysql5_arch" ]; then
+    bindir="$bindir/$mysql5_arch"
+    sbindir="$sbindir/$mysql5_arch"
+    libexecdir="$libexecdir/$mysql5_arch"
+  fi
+fi
+### END OPENCSW ARCHITECTURE SELECTION
+
+# Get arguments from the my.cnf file,
+# the only group, which is read from now on is [mysqld]
+if test -x ./bin/my_print_defaults
+then
+  print_defaults="./bin/my_print_defaults"
+elif test -x $bindir/my_print_defaults
+then
+  print_defaults="$bindir/my_print_defaults"
+elif test -x $bindir/mysql_print_defaults
+then
+  print_defaults="$bindir/mysql_print_defaults"
+else
+  # Try to find basedir in @sysconfdir@/my.cnf
+  conf=@sysconfdir@/my.cnf
+  print_defaults=
+  if test -r $conf
+  then
+    subpat='^[^=]*basedir[^=]*=\(.*\)$'
+    dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
+    for d in $dirs
+    do
+      d=`echo $d | sed -e 's/[ 	]//g'`
+      if test -x "$d/bin/my_print_defaults"
+      then
+        print_defaults="$d/bin/my_print_defaults"
+        break
+      fi
+      if test -x "$d/bin/mysql_print_defaults"
+      then
+        print_defaults="$d/bin/mysql_print_defaults"
+        break
+      fi
+    done
+  fi
+
+  # Hope it's in the PATH ... but I doubt it
+  test -z "$print_defaults" && print_defaults="my_print_defaults"
+fi
+
+#
+# Read defaults file from 'basedir'.   If there is no defaults file there
+# check if it's in the old (depricated) place (datadir) and read it from there
+#
+
+extra_args=""
+if test -r "$basedir/my.cnf"
+then
+  extra_args="-e $basedir/my.cnf"
+else
+  if test -r "$datadir/my.cnf"
+  then
+    extra_args="-e $datadir/my.cnf"
+  fi
+fi
+
+parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
+
+#
+# Set pid file if not given
+#
+if test -z "$mysqld_pid_file_path"
+then
+  mysqld_pid_file_path=$datadir/`hostname`.pid
+else
+  case "$mysqld_pid_file_path" in
+    /* ) ;;
+    * )  mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;;
+  esac
+fi
+
+case "$mode" in
+  'start')
+    # Start daemon
+
+    # Safeguard (relative paths, core dumps..)
+    # Changed to /opt for OpenCSW to avoid mysqld_safe picking the 32 bit
+    # binary in libexec/
+    cd /opt
+
+    echo $echo_n "Starting MySQL"
+    if test -x $bindir/mysqld_safe
+    then
+      # Give extra arguments to mysqld with the my.cnf file. This script
+      # may be overwritten at next upgrade.
+      $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
+      wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?
+
+      # Make lock for RedHat / SuSE
+      if test -w "$lockdir"
+      then
+        touch "$lock_file_path"
+      fi
+
+      exit $return_value
+    else
+      log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
+    fi
+    ;;
+
+  'stop')
+    # Stop daemon. We use a signal here to avoid having to know the
+    # root password.
+
+    if test -s "$mysqld_pid_file_path"
+    then
+      mysqld_pid=`cat "$mysqld_pid_file_path"`
+
+      if (kill -0 $mysqld_pid 2>/dev/null)
+      then
+        echo $echo_n "Shutting down MySQL"
+        kill $mysqld_pid
+        # mysqld should remove the pid file when it exits, so wait for it.
+        wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
+      else
+        log_failure_msg "MySQL server process #$mysqld_pid is not running!"
+        rm "$mysqld_pid_file_path"
+      fi
+
+      # Delete lock for RedHat / SuSE
+      if test -f "$lock_file_path"
+      then
+        rm -f "$lock_file_path"
+      fi
+      exit $return_value
+    else
+      log_failure_msg "MySQL server PID file could not be found!"
+    fi
+    ;;
+
+  'restart')
+    # Stop the service and regardless of whether it was
+    # running or not, start it again.
+    if $0 stop  $other_args; then
+      $0 start $other_args
+    else
+      log_failure_msg "Failed to stop running server, so refusing to try to start."
+      exit 1
+    fi
+    ;;
+
+  'reload'|'force-reload')
+    if test -s "$mysqld_pid_file_path" ; then
+      read mysqld_pid <  "$mysqld_pid_file_path"
+      kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
+      touch "$mysqld_pid_file_path"
+    else
+      log_failure_msg "MySQL PID file could not be found!"
+      exit 1
+    fi
+    ;;
+  'status')
+    # First, check to see if pid file exists
+    if test -s "$mysqld_pid_file_path" ; then
+      read mysqld_pid < "$mysqld_pid_file_path"
+      if kill -0 $mysqld_pid 2>/dev/null ; then
+        log_success_msg "MySQL running ($mysqld_pid)"
+        exit 0
+      else
+        log_failure_msg "MySQL is not running, but PID file exists"
+        exit 1
+      fi
+    else
+      # Try to find appropriate mysqld process
+      mysqld_pid=`pgrep $libexecdir/mysqld`
+      if test -z "$mysqld_pid" ; then
+        if test -f "$lock_file_path" ; then
+          log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
+          exit 2
+        fi
+        log_failure_msg "MySQL is not running"
+        exit 3
+      else
+        log_failure_msg "MySQL is running but PID file could not be found"
+        exit 4
+      fi
+    fi
+    ;;
+    *)
+      # usage
+      basename=`basename "$0"`
+      echo "Usage: $basename  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]"
+      exit 1
+    ;;
+esac
+
+exit 0

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list