From 0c0ef472876b8f353b29aa10768be88823d8399c Mon Sep 17 00:00:00 2001 From: Scott Barninger Date: Wed, 18 Feb 2004 21:23:04 +0000 Subject: [PATCH] Rename updatedb scripts for uniformity. Adeed code to 6_to7 scripts to check db. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1060 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/updatedb/update_mysql_tables_4_to_5 | 48 ++++++ bacula/updatedb/update_mysql_tables_5_to_6 | 97 +++++++++++ bacula/updatedb/update_mysql_tables_6_to_7 | 12 ++ bacula/updatedb/update_sqlite_tables_4_to_5 | 145 ++++++++++++++++ bacula/updatedb/update_sqlite_tables_5_to_6 | 175 ++++++++++++++++++++ bacula/updatedb/update_sqlite_tables_6_to_7 | 12 ++ 6 files changed, 489 insertions(+) create mode 100755 bacula/updatedb/update_mysql_tables_4_to_5 create mode 100755 bacula/updatedb/update_mysql_tables_5_to_6 create mode 100755 bacula/updatedb/update_sqlite_tables_4_to_5 create mode 100755 bacula/updatedb/update_sqlite_tables_5_to_6 diff --git a/bacula/updatedb/update_mysql_tables_4_to_5 b/bacula/updatedb/update_mysql_tables_4_to_5 new file mode 100755 index 0000000000..0a797e4180 --- /dev/null +++ b/bacula/updatedb/update_mysql_tables_4_to_5 @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Shell script to update MySQL tables from version 1.22 to 1.23 +# +echo " " +echo "This script will update a bacula database from version 4 to 5." +echo "Depending on the size of your database," +echo "this script may take several minutes to run." +echo " " + +# the location of the mysql program +bindir=/usr/bin + +DB_VER=`$bindir/mysql bacula -e 'select * from Version;'|tail -n 1 2>/dev/null` +if [ -z "$DB_VER" ]; then + echo "Sorry, I can't seem to locate a bacula database." + exit 1 +fi + +if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "4" ]; then + echo "Sorry, this script is designed to update a version 4 database" + echo "and you have a version $DB_VER database." + exit 1 +fi + +if $bindir/mysql -f </dev/null` +if [ -z "$DB_VER" ]; then + echo "Sorry, I can't seem to locate a bacula database." + exit 1 +fi + +if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "5" ]; then + echo "Sorry, this script is designed to update a version 5 database" + echo "and you have a version $DB_VER database." + exit 1 +fi + +if $bindir/mysql $* -f </dev/null` +if [ -z "$DB_VER" ]; then + echo "Sorry, I can't seem to locate a bacula database." + exit 1 +fi + +if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "6" ]; then + echo "Sorry, this script is designed to update a version 6 database" + echo "and you have a version $DB_VER database." + exit 1 +fi + if $bindir/mysql $* -f </dev/null` + if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "4" ]; then + echo "Sorry, this script is designed to update a version 4 database" + echo "and you have a version $DB_VER database." + exit 1 + fi +else + echo "Sorry, I can't seem to locate a bacula database." + exit 1 +fi + +$bindir/sqlite bacula.db </dev/null` + if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "5" ]; then + echo "Sorry, this script is designed to update a version 5 database" + echo "and you have a version $DB_VER database." + exit 1 + fi +else + echo "Sorry, I can't seem to locate a bacula database." + exit 1 +fi + +$bindir/sqlite $* bacula.db </dev/null` + if [ -n "$DB_VER" ] && [ "$DB_VER" -ne "6" ]; then + echo "Sorry, this script is designed to update a version 6 database" + echo "and you have a version $DB_VER database." + exit 1 + fi +else + echo "Sorry, I can't seem to locate a bacula database." + exit 1 +fi + $bindir/sqlite $* bacula.db <