[pkg-bacula-commits] [SCM] Bacula, a network backup, recovery and verification program branch, master, updated. debian/5.2.6+dfsg-2-2-g5b7963d

Alexander Golovko alexandro at ankalagon.ru
Tue Jul 3 09:00:51 UTC 2012


The following commit has been merged in the master branch:
commit 5b7963dc0f32390e31dbc26ac9ee9fa0d6b7ae38
Author: Alexander Golovko <alexandro at ankalagon.ru>
Date:   Tue Jul 3 12:20:22 2012 +0400

    Fix make_mysql_tables and update_mysql_tables
    
    There was impossible to use this scripts manually out-of-box.

diff --git a/debian/changelog b/debian/changelog
index ae03863..8d77977 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ bacula (5.2.6+dfsg-3) unstable; urgency=low
   * debian/rules:
     + fix daemons user/group on systems with systemd (Closes: #679958).
     + fix pid directory on systems with systemd.
+  * debian/patches/remove-use-statement-for-mysql (Closes: #679855):
+    + fix impossibility to run out-of-box scritps make_mysql_tables and
+      update_mysql_tables scripts, shipped with package.
 
  --
 
diff --git a/debian/patches/remove-use-statement-for-mysql b/debian/patches/remove-use-statement-for-mysql
index 72444af..7f9ed95 100644
--- a/debian/patches/remove-use-statement-for-mysql
+++ b/debian/patches/remove-use-statement-for-mysql
@@ -1,62 +1,119 @@
 Description: Since SQL installations and upgrade are handled by dbconfig and
  these scripts provided by upstream are simply processed and installed for
  dbconfig, the USE statement they include needs to be dropped. dbconfig keeps
- track of what database the user uses.
+ track of what database the user uses, but we need keep ability to run this
+ script manually in maneer similiarry to upstream.
+Bug: http://bugs.bacula.org/view.php?id=1901
 Author: Jan Hauke Rahm <jhr at debian.org>
+Author: Alexander Golovko <alexandro at ankalagon.ru>
 Reviewed-by: Alexander Golovko <alexandro at ankalagon.ru>
-Last-Update: 2012-06-02
+Last-Update: 2012-07-03
 
+diff --git a/src/cats/make_mysql_tables.in b/src/cats/make_mysql_tables.in
 --- a/src/cats/make_mysql_tables.in
 +++ b/src/cats/make_mysql_tables.in
-@@ -11,7 +11,6 @@ PATH="$bindir:$PATH"
+@@ -10,8 +10,7 @@ bindir=@MYSQL_BINDIR@
+ PATH="$bindir:$PATH"
  db_name=${db_name:- at db_name@}
  
- if mysql $* -f <<END-OF-DATA
+-if mysql $* -f <<END-OF-DATA
 -USE ${db_name};
++if mysql -D ${db_name} $* -f <<END-OF-DATA
  --
  -- Note, we use BLOB rather than TEXT because in MySQL,
  --  BLOBs are identical to TEXT except that BLOB is case
+diff --git a/src/cats/update_mysql_tables.in b/src/cats/update_mysql_tables.in
 --- a/src/cats/update_mysql_tables.in
 +++ b/src/cats/update_mysql_tables.in
-@@ -22,8 +22,6 @@ if [ $DBVERSION != 12 ] ; then
+@@ -8,11 +8,11 @@ echo " which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
+ echo " "
+ bindir=@MYSQL_BINDIR@
+ PATH="$bindir:$PATH"
+-db_name=@db_name@
++db_name=${db_name:- at db_name@}
+ 
+-mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$
++mysql -D ${db_name} $* -e "select VersionId from Version\G" >/tmp/$$
+ DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
+-if [ $DBVERSION != 12 ] ; then
++if [ "$DBVERSION" != 12 ] ; then
+    echo " "
+    echo "The existing database is version $DBVERSION !!"
+    echo "This script can only update an existing version 12 database to version 14."
+@@ -21,9 +21,7 @@ if [ $DBVERSION != 12 ] ; then
+    exit 1
  fi
  
- if mysql $* -f <<END-OF-DATA
+-if mysql $* -f <<END-OF-DATA
 -USE ${db_name};
 -
++if mysql -D ${db_name} $* -f <<END-OF-DATA
  CREATE TABLE RestoreObject (
     RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
     ObjectName BLOB NOT NULL,
+diff --git a/updatedb/update_mysql_tables_10_to_11.in b/updatedb/update_mysql_tables_10_to_11.in
 --- a/updatedb/update_mysql_tables_10_to_11.in
 +++ b/updatedb/update_mysql_tables_10_to_11.in
-@@ -11,8 +11,6 @@ PATH="$bindir:$PATH"
+@@ -10,9 +10,7 @@ bindir=@MYSQL_BINDIR@
+ PATH="$bindir:$PATH"
  db_name=${db_name:- at db_name@}
  
- if mysql $* -f <<END-OF-DATA
+-if mysql $* -f <<END-OF-DATA
 -USE ${db_name};
 -
++if mysql -D ${db_name} $* -f <<END-OF-DATA
  -- Fix bad index on Media table
  DROP INDEX inx8 ON Media;
  CREATE UNIQUE INDEX inx8 ON Media (VolumeName(128));
+diff --git a/updatedb/update_mysql_tables_11_to_12.in b/updatedb/update_mysql_tables_11_to_12.in
 --- a/updatedb/update_mysql_tables_11_to_12.in
 +++ b/updatedb/update_mysql_tables_11_to_12.in
-@@ -22,8 +22,6 @@ if [ $DBVERSION != 11 ] ; then
+@@ -10,9 +10,9 @@ bindir=@MYSQL_BINDIR@
+ PATH="$bindir:$PATH"
+ db_name=${db_name:- at db_name@}
+ 
+-mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$
++mysql -D ${db_name} $* -e "select VersionId from Version\G" >/tmp/$$
+ DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
+-if [ $DBVERSION != 11 ] ; then
++if [ "$DBVERSION" != 11 ] ; then
+    echo " "
+    echo "The existing database is version $DBVERSION !!"
+    echo "This script can only update an existing version 11 database to version 12."
+@@ -21,9 +21,7 @@ if [ $DBVERSION != 11 ] ; then
+    exit 1
  fi
  
- if mysql $* -f <<END-OF-DATA
+-if mysql $* -f <<END-OF-DATA
 -USE ${db_name};
 -
++if mysql -D ${db_name} $* -f <<END-OF-DATA
  ALTER TABLE JobMedia DROP Stripe ;
  ALTER TABLE JobMedia DROP Copy ;
  ALTER TABLE Job ADD COLUMN HasCache tinyint default 0 after HasBase;
+diff --git a/updatedb/update_mysql_tables_12_to_14.in b/updatedb/update_mysql_tables_12_to_14.in
 --- a/updatedb/update_mysql_tables_12_to_14.in
 +++ b/updatedb/update_mysql_tables_12_to_14.in
-@@ -22,8 +22,6 @@ if [ $DBVERSION != 12 ] ; then
+@@ -8,9 +8,9 @@ echo " which is needed to convert from Bacula Community version 5.0.x to 5.2.x"
+ echo " "
+ bindir=@MYSQL_BINDIR@
+ PATH="$bindir:$PATH"
+-db_name=@db_name@
++db_name=${db_name:- at db_name@}
+ 
+-mysql $* -D ${db_name} -e "select VersionId from Version\G" >/tmp/$$
++mysql -D ${db_name} $* -e "select VersionId from Version\G" >/tmp/$$
+ DBVERSION=`sed -n -e 's/^VersionId: \(.*\)$/\1/p' /tmp/$$`
+ if [ $DBVERSION != 12 ] ; then
+    echo " "
+@@ -21,9 +21,7 @@ if [ $DBVERSION != 12 ] ; then
+    exit 1
  fi
  
- if mysql $* -f <<END-OF-DATA
+-if mysql $* -f <<END-OF-DATA
 -USE ${db_name};
 -
++if mysql -D ${db_name} $* -f <<END-OF-DATA
  CREATE TABLE RestoreObject (
     RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
     ObjectName BLOB NOT NULL,

-- 
Bacula, a network backup, recovery and verification program



More information about the pkg-bacula-commits mailing list