# 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 "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 <<END-OF-DATA
USE bacula;