#!/bin/bash
#
# This routine makes the appropriately configured
#  Bacula tables for PostgreSQL or MySQL.
# SQLite does not have permissions.
#

RETVAL=0

. /etc/sysconfig/bacula

case "$BACULA_BACKEND" in
    postgresql)
        echo "Granting PostgreSQL privileges"
        /usr/share/bacula/grant_postgresql_privileges $*
        ;;
    sqlite)
        echo "Granting SQLite privileges"
        /usr/share/bacula/grant_sqlite_privileges $*
        ;;
    sqlite3)
        echo "Granting SQLite3 privileges"
        /usr/share/bacula/grant_sqlite3_privileges $*
        ;;
    mysql)
        echo "Granting MySQL privileges"
        /usr/share/bacula/grant_mysql_privileges $*
        ;;
    *)
        echo "Unknown database type"
        $RETVAL=1
        ;;
esac

exit $RETVAL
