#!/bin/sh
#
-# shell script to create Bacula database(s)
+# shell script to grant privileges to the bacula database
#
-
+db_user=${db_user:-@db_user@}
bindir=@SQL_BINDIR@
+db_name=${db_name:-@db_name@}
if $bindir/mysql $* -u root -f <<END-OF-DATA
use mysql
-grant all privileges on *.* to kern@localhost with grant option;
-grant all privileges on *.* to kern@"%" with grant option;
-grant all privileges on *.* to kelvin@localhost with grant option;
-grant all privileges on *.* to kelvin@"%" with grant option;
-grant all privileges on *.* to bacula@localhost with grant option;
-grant all privileges on *.* to bacula@"%" with grant option;
+grant all privileges on ${db_name}.* to ${db_user}@localhost;
+grant all privileges on ${db_name}.* to ${db_user}@"%";
select * from user;
flush privileges;
END-OF-DATA
then
- echo "Privileges for kern, kelvin, and bacula granted."
+ echo "Privileges for ${db_user} granted on ${db_name}."
exit 0
else
echo "Error creating privileges."