[DRE-commits] [ruby-mysql2] 04/06: debian/start_mysqld_and_auto_install.sh: skip database creation

Antonio Terceiro terceiro at moszumanska.debian.org
Tue Jul 21 01:28:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch master
in repository ruby-mysql2.

commit 9fd1de7669b92cc6a13af2a89fde3119758a0ed8
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Mon Jul 20 22:07:22 2015 -0300

    debian/start_mysqld_and_auto_install.sh: skip database creation
    
    Closes: #791785
---
 debian/changelog                        |  3 +++
 debian/rules                            |  1 -
 debian/start_mysqld_and_auto_install.sh | 18 ++++++++----------
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3694b82..b07c6b9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ ruby-mysql2 (0.3.18-1) UNRELEASED; urgency=medium
   * Refresh patches
     - avoid_openssl_loop.patch dropped, applied upstream
     - correct_mysql_init.patch dropped, applied upstream
+  * debian/start_mysqld_and_auto_install.sh: skip database creation, since
+    mysql seems to already create a database called `test` by default.
+    Closes: #791785, #782768
 
  -- Antonio Terceiro <terceiro at debian.org>  Mon, 20 Jul 2015 21:31:34 -0300
 
diff --git a/debian/rules b/debian/rules
index 8399961..dc9ad69 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,5 +18,4 @@
 override_dh_auto_install:
 	cp spec/configuration.yml.example spec/configuration.yml
 	cp spec/my.cnf.example spec/my.cnf
-	chmod +x debian/start_mysqld_and_auto_install.sh
 	debian/start_mysqld_and_auto_install.sh
diff --git a/debian/start_mysqld_and_auto_install.sh b/debian/start_mysqld_and_auto_install.sh
index 2f37bee..9166152 100755
--- a/debian/start_mysqld_and_auto_install.sh
+++ b/debian/start_mysqld_and_auto_install.sh
@@ -29,16 +29,14 @@ while ! /usr/bin/mysqladmin --socket=${MYSQL_UNIX_PORT} ping ; do
     exit 0
   fi
 done
-mysql --socket=${MYSQL_UNIX_PORT} --execute "CREATE DATABASE ${DO_MYSQL_DBNAME};"
-mysql --socket=${MYSQL_UNIX_PORT} --execute "GRANT ALL PRIVILEGES ON ${DO_MYSQL_DBNAME}.* TO '${DO_MYSQL_USER}'@'localhost' IDENTIFIED BY '${DO_MYSQL_PASS}';"
-
-# Keep running so we can terminate mysqld
-set +e
 
-dh_auto_install
-RC=$?
+cleanup() {
+  /usr/bin/mysqladmin --socket=${MYSQL_UNIX_PORT} shutdown
+  rm -rf ${MYTEMP_DIR}
+}
+trap cleanup INT EXIT TERM
 
-/usr/bin/mysqladmin --socket=${MYSQL_UNIX_PORT} shutdown
-rm -rf ${MYTEMP_DIR}
+# database `test` is already created by default
+mysql --socket=${MYSQL_UNIX_PORT} --execute "GRANT ALL PRIVILEGES ON ${DO_MYSQL_DBNAME}.* TO '${DO_MYSQL_USER}'@'localhost' IDENTIFIED BY '${DO_MYSQL_PASS}';"
 
-exit $RC
+dh_auto_install

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-mysql2.git



More information about the Pkg-ruby-extras-commits mailing list