From c94b8d9fcf80ba414f23d570313f70fb662abfb8 Mon Sep 17 00:00:00 2001 From: Scott Barninger Date: Sun, 31 Oct 2004 16:57:09 +0000 Subject: [PATCH] Fix have-sqlite-db but don't-have-sqlite. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1672 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/platforms/mandrake/bacula.spec.in | 14 ++++++++++++-- bacula/platforms/redhat/bacula.spec.in | 14 ++++++++++++-- bacula/platforms/suse/bacula.spec.in | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/bacula/platforms/mandrake/bacula.spec.in b/bacula/platforms/mandrake/bacula.spec.in index ff99153541..8f281ac92e 100644 --- a/bacula/platforms/mandrake/bacula.spec.in +++ b/bacula/platforms/mandrake/bacula.spec.in @@ -810,7 +810,7 @@ fi %pre sqlite # test for bacula database older than version 7 -if [ -s %{working_dir}/bacula.db ];then +if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null` if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then echo "This bacula upgrade will update a bacula database from version 7 to 8." @@ -839,7 +839,16 @@ fi if [ -s %{working_dir}/bacula.db ]; then DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null` # check to see if we need to upgrade a 1.34 or lower database - if [ "$DB_VER" -lt "8" ]; then + if [ "$DB_VER" -lt "7" ]; then + echo "This bacula upgrade requires a database update to version 8. You appear to" + echo "be running database version $DB_VER. You must update your database using the" + echo "upgrade scripts in the bacula-updatedb package. The alternative" + echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current" + echo "catalog information, then /etc/bacula/make_sqlite_tables. Information on updating a" + echo "database older than version 7 can be found in the release notes." + fi + + if [ "$DB_VER" -lt "8" ] && [ "$DB_VER" -ge "7" ]; then echo "This release requires an upgrade to your bacula database." echo "Backing up your current database..." echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2 @@ -1111,6 +1120,7 @@ echo "The database update scripts were installed to /etc/bacula/updatedb" %changelog * Sun Oct 31 2004 D. Scott Barninger - misc fixes from 1.36.0 suse feedback +- fix situation where sqlite database exists but sqlite has been removed. * Fri Oct 22 2004 D. Scott Barninger - remove tray-monitor from RH8 build - fix permissions on tray-monitor files diff --git a/bacula/platforms/redhat/bacula.spec.in b/bacula/platforms/redhat/bacula.spec.in index ff99153541..8f281ac92e 100644 --- a/bacula/platforms/redhat/bacula.spec.in +++ b/bacula/platforms/redhat/bacula.spec.in @@ -810,7 +810,7 @@ fi %pre sqlite # test for bacula database older than version 7 -if [ -s %{working_dir}/bacula.db ];then +if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null` if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then echo "This bacula upgrade will update a bacula database from version 7 to 8." @@ -839,7 +839,16 @@ fi if [ -s %{working_dir}/bacula.db ]; then DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null` # check to see if we need to upgrade a 1.34 or lower database - if [ "$DB_VER" -lt "8" ]; then + if [ "$DB_VER" -lt "7" ]; then + echo "This bacula upgrade requires a database update to version 8. You appear to" + echo "be running database version $DB_VER. You must update your database using the" + echo "upgrade scripts in the bacula-updatedb package. The alternative" + echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current" + echo "catalog information, then /etc/bacula/make_sqlite_tables. Information on updating a" + echo "database older than version 7 can be found in the release notes." + fi + + if [ "$DB_VER" -lt "8" ] && [ "$DB_VER" -ge "7" ]; then echo "This release requires an upgrade to your bacula database." echo "Backing up your current database..." echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2 @@ -1111,6 +1120,7 @@ echo "The database update scripts were installed to /etc/bacula/updatedb" %changelog * Sun Oct 31 2004 D. Scott Barninger - misc fixes from 1.36.0 suse feedback +- fix situation where sqlite database exists but sqlite has been removed. * Fri Oct 22 2004 D. Scott Barninger - remove tray-monitor from RH8 build - fix permissions on tray-monitor files diff --git a/bacula/platforms/suse/bacula.spec.in b/bacula/platforms/suse/bacula.spec.in index ff99153541..8f281ac92e 100644 --- a/bacula/platforms/suse/bacula.spec.in +++ b/bacula/platforms/suse/bacula.spec.in @@ -810,7 +810,7 @@ fi %pre sqlite # test for bacula database older than version 7 -if [ -s %{working_dir}/bacula.db ];then +if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null` if [ -n "$DB_VER" ] && [ "$DB_VER" -lt "7" ]; then echo "This bacula upgrade will update a bacula database from version 7 to 8." @@ -839,7 +839,16 @@ fi if [ -s %{working_dir}/bacula.db ]; then DB_VER=`echo "select * from Version;" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | tail -n 1 2>/dev/null` # check to see if we need to upgrade a 1.34 or lower database - if [ "$DB_VER" -lt "8" ]; then + if [ "$DB_VER" -lt "7" ]; then + echo "This bacula upgrade requires a database update to version 8. You appear to" + echo "be running database version $DB_VER. You must update your database using the" + echo "upgrade scripts in the bacula-updatedb package. The alternative" + echo "is to use /etc/bacula/drop_sqlite_tables to delete all your your current" + echo "catalog information, then /etc/bacula/make_sqlite_tables. Information on updating a" + echo "database older than version 7 can be found in the release notes." + fi + + if [ "$DB_VER" -lt "8" ] && [ "$DB_VER" -ge "7" ]; then echo "This release requires an upgrade to your bacula database." echo "Backing up your current database..." echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2 @@ -1111,6 +1120,7 @@ echo "The database update scripts were installed to /etc/bacula/updatedb" %changelog * Sun Oct 31 2004 D. Scott Barninger - misc fixes from 1.36.0 suse feedback +- fix situation where sqlite database exists but sqlite has been removed. * Fri Oct 22 2004 D. Scott Barninger - remove tray-monitor from RH8 build - fix permissions on tray-monitor files -- 2.39.5