summaryrefslogtreecommitdiff
path: root/dev-db
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2013-01-18 01:51:47 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2013-01-18 01:51:47 +0000
commita9d63015c67b366e0bf6c3212639c1e1f6d384b8 (patch)
tree072b7b4709ca583cf2b027267ec56b1c0831d0d7 /dev-db
parentBump per bug #439334. (diff)
downloadgentoo-2-a9d63015c67b366e0bf6c3212639c1e1f6d384b8.tar.gz
gentoo-2-a9d63015c67b366e0bf6c3212639c1e1f6d384b8.tar.bz2
gentoo-2-a9d63015c67b366e0bf6c3212639c1e1f6d384b8.zip
Bug #423387: /var/run fix. Bug #452562/#175783: checkbashisms.
(Portage version: 2.2.0_alpha144/cvs/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'dev-db')
-rw-r--r--dev-db/mysql-init-scripts/ChangeLog11
-rw-r--r--dev-db/mysql-init-scripts/files/mysql-5.1.67-init.d118
-rw-r--r--dev-db/mysql-init-scripts/mysql-init-scripts-2.0_pre1-r3.ebuild56
3 files changed, 182 insertions, 3 deletions
diff --git a/dev-db/mysql-init-scripts/ChangeLog b/dev-db/mysql-init-scripts/ChangeLog
index b6ee78c677ff..f6d35f84c5ca 100644
--- a/dev-db/mysql-init-scripts/ChangeLog
+++ b/dev-db/mysql-init-scripts/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for dev-db/mysql-init-scripts
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/ChangeLog,v 1.14 2012/03/08 14:57:22 ranger Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/ChangeLog,v 1.15 2013/01/18 01:51:47 robbat2 Exp $
+
+*mysql-init-scripts-2.0_pre1-r3 (18 Jan 2013)
+
+ 18 Jan 2013; Robin H. Johnson <robbat2@gentoo.org> +files/mysql-5.1.67-init.d,
+ +mysql-init-scripts-2.0_pre1-r3.ebuild:
+ Bug #423387: /var/run fix. Bug #452562/#175783: checkbashisms.
08 Mar 2012; Brent Baude <ranger@gentoo.org>
mysql-init-scripts-2.0_pre1-r2.ebuild:
@@ -71,4 +77,3 @@
12 Jan 2007; Luca Longinotti <chtekk@gentoo.org> ChangeLog:
Move from sys-apps/mysql.
-
diff --git a/dev-db/mysql-init-scripts/files/mysql-5.1.67-init.d b/dev-db/mysql-init-scripts/files/mysql-5.1.67-init.d
new file mode 100644
index 000000000000..511a6bfdf318
--- /dev/null
+++ b/dev-db/mysql-init-scripts/files/mysql-5.1.67-init.d
@@ -0,0 +1,118 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/files/mysql-5.1.67-init.d,v 1.1 2013/01/18 01:51:47 robbat2 Exp $
+
+depend() {
+ use net.lo
+ # localmount needed for $basedir
+ need localmount
+}
+
+get_config() {
+ my_print_defaults --config-file="$1" mysqld |
+ sed -n -e "s/^--$2=//p"
+}
+
+mysql_svcname() {
+ local ebextra=
+ case "${SVCNAME}" in
+ mysql*) ;;
+ *) ebextra=" (mysql)" ;;
+ esac
+ echo "${SVCNAME}${ebextra}"
+}
+
+start() {
+ # Check for old conf.d variables that mean migration was not yet done.
+ set | egrep -sq '^(mysql_slot_|MYSQL_BLOG_PID_FILE|STOPTIMEOUT)'
+ rc=$?
+ # Yes, MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING is a hidden variable.
+ # It does have a use in testing, as it is possible to build a config file
+ # that works with both the old and new init scripts simulateously.
+ if [ "${rc}" = 0 -a -z "${MYSQL_INIT_I_KNOW_WHAT_I_AM_DOING}" ]; then
+ eerror "You have not updated your conf.d for the new mysql-init-scripts-2 revamp."
+ eerror "Not proceeding because it may be dangerous."
+ return 1
+ fi
+
+ # Now we can startup
+ ebegin "Starting $(mysql_svcname)"
+
+ MY_CNF="${MY_CNF:-/etc/${SVCNAME}/my.cnf}"
+
+ if [ ! -r "${MY_CNF}" ] ; then
+ eerror "Cannot read the configuration file \`${MY_CNF}'"
+ return 1
+ fi
+
+ # tail -n1 is critical as these we only want the last instance of the option
+ local basedir=$(get_config "${MY_CNF}" basedir | tail -n1)
+ local datadir=$(get_config "${MY_CNF}" datadir | tail -n1)
+ local pidfile=$(get_config "${MY_CNF}" pid-file | tail -n1)
+ local socket=$(get_config "${MY_CNF}" socket | tail -n1)
+
+ if [ ! -d "${datadir}" ] ; then
+ eerror "MySQL datadir \`${datadir}' is empty or invalid"
+ eerror "Please check your config file \`${MY_CNF}'"
+ return 1
+ fi
+
+ if [ ! -d "${datadir}"/mysql ] ; then
+ eerror "You don't appear to have the mysql database installed yet."
+ eerror "Please run /usr/bin/mysql_install_db to have this done..."
+ return 1
+ fi
+
+ local piddir="${pidfile%/*}"
+ checkpath -d --owner mysql:mysql --mode 0755 "$piddir"
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ eerror "Directory $piddir for pidfile does not exist and cannot be created"
+ return 1
+ fi
+
+ local startup_timeout=${STARTUP_TIMEOUT:-900}
+ local startup_early_timeout=${STARTUP_EARLY_TIMEOUT:-1000}
+ local tmpnice="${NICE:+"--nicelevel "}${NICE}"
+ local tmpionice="${IONICE:+"--ionice "}${IONICE}"
+ start-stop-daemon \
+ ${DEBUG:+"--verbose"} \
+ --start \
+ --exec "${basedir}"/sbin/mysqld \
+ --pidfile "${pidfile}" \
+ --background \
+ --wait ${startup_early_timeout} \
+ ${tmpnice} \
+ ${tmpionice} \
+ -- --defaults-file="${MY_CNF}" ${MY_ARGS}
+ local ret=$?
+ if [ ${ret} -ne 0 ] ; then
+ eend ${ret}
+ return ${ret}
+ fi
+
+ ewaitfile ${startup_timeout} "${socket}"
+ eend $? || return 1
+
+ save_options pidfile "${pidfile}"
+ save_options basedir "${basedir}"
+}
+
+stop() {
+ ebegin "Stopping $(mysql_svcname)"
+
+ local pidfile="$(get_options pidfile)"
+ local basedir="$(get_options basedir)"
+ local stop_timeout=${STOP_TIMEOUT:-120}
+
+ start-stop-daemon \
+ ${DEBUG:+"--verbose"} \
+ --stop \
+ --exec "${basedir}"/sbin/mysqld \
+ --pidfile "${pidfile}" \
+ --retry ${stop_timeout}
+ eend $?
+}
+# vim: filetype=gentoo-init-d sw=2 ts=2 sts=2 noet:
+
diff --git a/dev-db/mysql-init-scripts/mysql-init-scripts-2.0_pre1-r3.ebuild b/dev-db/mysql-init-scripts/mysql-init-scripts-2.0_pre1-r3.ebuild
new file mode 100644
index 000000000000..d183db2c7817
--- /dev/null
+++ b/dev-db/mysql-init-scripts/mysql-init-scripts-2.0_pre1-r3.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/mysql-init-scripts/mysql-init-scripts-2.0_pre1-r3.ebuild,v 1.1 2013/01/18 01:51:47 robbat2 Exp $
+
+DESCRIPTION="Gentoo MySQL init scripts."
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=""
+# This _will_ break with MySQL 5.0, 4.x, 3.x
+# It also NEEDS openrc for the save_options/get_options builtins.
+RDEPEND="!<dev-db/mysql-5.1
+ sys-apps/openrc"
+
+src_install() {
+ newconfd "${FILESDIR}/mysql-5.1.53-conf.d" "mysql"
+ newinitd "${FILESDIR}/mysql-5.1.67-init.d" "mysql"
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/logrotate.mysql" "mysql"
+}
+
+pkg_postinst() {
+ grep -sq mysql_slot "${ROOT}"/etc/conf.d/mysql
+ old_conf_present=$?
+ grep -sq get_slot_config "${ROOT}"/etc/init.d/mysql
+ old_init_present=$?
+
+ egrep -sq 'MY_CNF|MY_ARGS|(STARTUP|STOP)_TIMEOUT' "${ROOT}"/etc/conf.d/mysql
+ new_conf_present=$?
+ egrep -sq 'MY_ARGS|STOP_TIMEOUT' "${ROOT}"/etc/init.d/mysql
+ new_init_present=$?
+
+ einfo "Please note if you are using multiple internal 'slots' in the old"
+ einfo "conf.d fille, that you should use multiple init files now."
+ echo old $old_conf_present $old_init_present
+ echo new $new_conf_present $new_init_present
+
+ # new scripts present
+ if [ $new_conf_present -eq 0 -a $new_init_present -eq 0 -a \
+ $old_conf_present -eq 1 -a $old_init_present -eq 1 ]; then
+ :
+ elif [ $old_conf_present -eq 0 -a $old_init_present -eq 0 -a \
+ $new_conf_present -eq 1 -a $new_init_present -eq 1 ]; then
+ ewarn "Old /etc/init.d/mysql and /etc/conf.d/mysql still present!"
+ ewarn "Update both of those files to the new versions!"
+ else
+ eerror "DANGER, mixed update of /etc/init.d/mysql and /etc/conf.d/mysql"
+ eerror "detected! You must update BOTH to the new versions"
+ fi
+}