]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/platforms/redhat/bacula.spec
Fix Mysql database upgrade.
[bacula/bacula] / bacula / platforms / redhat / bacula.spec
index e66565b14a3e0dc92550927d141b6d1f89f73dc8..20e579595d29f7eb68e3c950d3f96fe503048e77 100644 (file)
@@ -230,6 +230,7 @@ Prefix: %{_prefix}
 
 Source0: http://www.prdownloads.sourceforge.net/bacula/%{name}-%{version}.tar.gz
 # opensuse build service changes the release itself
+# what happens if the release is not 1? DSB
 %if 0%{?opensuse_bs}
 Source1: Release_Notes-%{version}-1.tar.gz
 %else
@@ -976,7 +977,7 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 # The rest is DB backend independent
 %endif
 # opensuse_bs: directories not owned by any package
-#/etc/bacula
+%dir %attr(-, root, %{daemon_group}) %{sysconf_dir}
 
 %if ! %{client_only}
 %attr(-, root, %{daemon_group}) %dir %{script_dir}
@@ -1001,6 +1002,7 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %attr(-, root, %{daemon_group}) %{script_dir}/bpipe-fd.so
 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
 %attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
+%attr(-, root, %{daemon_group}) %{_sbindir}/dbcheck
 %attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
 %attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
 %attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
@@ -1030,7 +1032,6 @@ rm -f $RPM_BUILD_DIR/Release_Notes-%{version}-%{release}.txt
 %{_sbindir}/btape
 %{_sbindir}/btraceback
 %{_sbindir}/bconsole
-%{_sbindir}/dbcheck
 %{_sbindir}/bsmtp
 %{_sbindir}/bregex
 %{_sbindir}/bwild
@@ -1071,24 +1072,24 @@ DB_VER=`mysql 2>/dev/null bacula -e 'select * from Version;'|tail -n 1`
 # are we upgrading from sqlite to sqlite3?
 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite ];then
         echo "This version of bacula-sqlite involves an upgrade to sqlite3."
-       echo "Your catalog database file is not compatible with sqlite3, thus"
-       echo "you will need to dump the data, delete the old file, and re-run"
-       echo "this rpm upgrade."
-       echo ""
-       echo "Backing up your current database..."
+        echo "Your catalog database file is not compatible with sqlite3, thus"
+        echo "you will need to dump the data, delete the old file, and re-run"
+        echo "this rpm upgrade."
+        echo ""
+        echo "Backing up your current database..."
         echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db > %{working_dir}/bacula_backup.sql
-       mv %{working_dir}/bacula.db %{working_dir}/bacula.db.old
-       echo "Your catalog data has been saved in %{working_dir}/bacula_backup.sql and your"
-       echo "catalog file has been renamed %{working_dir}/bacula.db.old."
-       echo ""
-       echo "Please re-run this rpm package upgrade."
-       echo "After the upgrade is complete, restore your catalog"
-       echo "with the following commands:"
-       echo "%{script_dir}/drop_sqlite3_tables"
-       echo "cd %{working_dir}"
-       echo "%{sqlite_bindir}/sqlite3 $* bacula.db < bacula_backup.sql"
-       echo "chown bacula.bacula bacula.db"
-       exit 1
+        mv %{working_dir}/bacula.db %{working_dir}/bacula.db.old
+        echo "Your catalog data has been saved in %{working_dir}/bacula_backup.sql and your"
+        echo "catalog file has been renamed %{working_dir}/bacula.db.old."
+        echo ""
+        echo "Please re-run this rpm package upgrade."
+        echo "After the upgrade is complete, restore your catalog"
+        echo "with the following commands:"
+        echo "%{script_dir}/drop_sqlite3_tables"
+        echo "cd %{working_dir}"
+        echo "%{sqlite_bindir}/sqlite3 $* bacula.db < bacula_backup.sql"
+        echo "chown bacula.bacula bacula.db"
+        exit 1
 fi
 # test for bacula database older than version 11 and sqlite3
 if [ -s %{working_dir}/bacula.db ] && [ -s %{sqlite_bindir}/sqlite3 ];then
@@ -1217,7 +1218,7 @@ if [ -z "$DB_VER" ]; then
     %{script_dir}/make_mysql_tables
 
 # check to see if we need to upgrade a 3.x database
-elif [ "$DB_VER" -lt "11" ]; then
+elif [ "$DB_VER" -lt "12" ]; then
     echo "This release requires an upgrade to your bacula database."
     echo "Backing up your current database..."
     mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
@@ -1239,17 +1240,17 @@ if [ -s %{working_dir}/bacula.db ]; then
                 echo "Backing up your current database..."
                 echo ".dump" | %{sqlite_bindir}/sqlite3 %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
                 echo "Upgrading bacula database ..."
-               %{script_dir}/update_sqlite3_tables
+                %{script_dir}/update_sqlite3_tables
                 echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
         fi
 else
         # create the database and tables
         echo "Hmm, doesn't look like you have an existing database."
         echo "Creating SQLite database..."
-       %{script_dir}/create_sqlite3_database
-       chown %{director_daemon_user}.%{daemon_group} %{working_dir}/bacula.db
+        %{script_dir}/create_sqlite3_database
+        chown %{director_daemon_user}.%{daemon_group} %{working_dir}/bacula.db
         echo "Creating the SQLite tables..."
-       %{script_dir}/make_sqlite3_tables
+        %{script_dir}/make_sqlite3_tables
 fi
 %endif
 
@@ -1367,7 +1368,7 @@ fi
 %_prefix/share/doc/*
 
 #opensuse_bs: directories not owned by any package
-#/etc/bacula
+%dir %attr(-, root, %{daemon_group}) %{sysconf_dir}
 
 %pre client
 # create the daemon group and user
@@ -1448,6 +1449,11 @@ echo "The database update scripts were installed to %{script_dir}/updatedb"
 %endif
 
 %changelog
+* Sun Feb 07 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- fix mysql database upgrade
+* Fri Feb 05 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- fix permissions of dbcheck
+- misc. cleanup
 * Sat Jan 30 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
 - 5.0.0
 - add su112 and fc10 builds, remove doc package declaration.