From: Scott Barninger Date: Wed, 18 Feb 2004 21:23:04 +0000 (+0000) Subject: Rename updatedb scripts for uniformity. Adeed code to 6_to7 scripts to check db. X-Git-Tag: Release-1.34.0~118 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0c0ef472876b8f353b29aa10768be88823d8399c;p=bacula%2Fbacula 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 --- 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 <