#!/bin/sh
#
# This script dumps your Bacula catalog in ASCII format
#  It works for either MySQL or SQLite
#
cd @working_dir@
rm -f bacula.sql
if test xsqlite = x@DB_NAME@ ; then
  echo ".dump" | @SQL_BINDIR@/sqlite $* bacula.db >bacula.sql
else
  if test xmysql = x@DB_NAME@ ; then
    @SQL_BINDIR@/mysqldump $* -f --opt bacula >bacula.sql
  else
    @SQL_BINDIR@/pg_dump $* bacula >bacula.sql
  fi
fi
#
#  To read back a MySQL database use: 
#     cd @working_dir@
#     rm -f @SQL_BINDIR@/../var/bacula/*
#     mysql <bacula.sql
#
#  To read back a SQLite database use:
#     cd @working_dir@
#     rm -f bacula.db
#     sqlite bacula.db <bacula.sql
#
#  To read back a PostgreSQL database use:
#     cd @working_dir@
#     dropdb bacula
#     psql bacula <bacula.sql
#
