-%post dir
-umask 077
-[ -s %{_localstatedir}/bacula.db ] && \
- DB_VER=`echo "select * from Version;" | \
- %{_bindir}/sqlite%{?with_sqlite3:3} %{_localstatedir}/bacula.db | tail -n 1 2>/dev/null`
-if [ -z "$DB_VER" ]; then
-# grant privileges and create tables
- %{_libexecdir}/%{name}/grant_bacula_privileges > dev/null
- %{_libexecdir}/%{name}/create_bacula_database > dev/null
- %{_libexecdir}/%{name}/make_bacula_tables > dev/null
-elif [ "$DB_VER" -lt "9" ]; then
- echo "Backing up bacula tables"
- echo ".dump" | sqlite%{?with_sqlite3:3} %{_localstatedir}/bacula.db | bzip2 > %{_localstatedir}/bacula_backup.sql.bz2
- echo "Upgrading bacula tables"
- %if %{with sqlite3}
- type=sqlite3
- if [ "$DB_VER" -lt "9" ]; then
- %{_libexecdir}/%{name}/update_${type}_tables_8_to_9
- fi
- %endif
- %if %{with sqlite}
- type=sqlite
- if [ "$DB_VER" -lt "9" ]; then
- if [ "$DB_VER" -lt "8" ]; then
- if [ "$DB_VER" -lt "7" ]; then
- if [ "$DB_VER" -lt "6" ]; then
- if [ "$DB_VER" -lt "5" ]; then
- %{_libexecdir}/%{name}/update_${type}_tables_4_to_5
- fi
- %{_libexecdir}/%{name}/update_${type}_tables_5_to_6
- fi
- %{_libexecdir}/%{name}/update_${type}_tables_6_to_7
- fi
- %{_libexecdir}/%{name}/update_${type}_tables_7_to_8
- fi
- %{_libexecdir}/%{name}/update_${type}_tables_8_to_9
- fi
- %endif
- %{_libexecdir}/%{name}/update_bacula_tables
- echo "If bacula works correctly you can remove the backup file %{_localstatedir}/bacula_backup.sql.bz2"
-fi
-chown -R bacula:bacula %{_localstatedir}
-chmod -R u+rX,go-rwx %{_localstatedir}/*
-
-echo "Updating Bacula passwords and names..."
-cd /etc/bacula
-for f in *-password ; do
- p=`cat $f`
- sed -i -e"s:#FAKE-$f#:$p:" *.conf *.conf.rpmnew 2>/dev/null || :
-done
-sed -i -e"s:--hostname--:`hostname`:" *.conf *.conf.rpmnew 2>/dev/null || :
+%triggerpostun dir -- %{name}-dir < %{version}-0
+%banner bacula-dir -t3 <<EOF
+You have upgraded from an older version of Bacula director.
+
+You will probably need to call %{_libexecdir}/%{name}/update_bacula_tables
+script to upgrade the database.