]> git.sur5r.net Git - bacula/bacula/commitdiff
Creating a database as an other user and giving grants doesn't seem to work for Ingre...
authorMarco van Wieringen <mvw@planets.elm.net>
Sat, 3 Apr 2010 20:18:55 +0000 (22:18 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 2 Aug 2010 14:49:44 +0000 (16:49 +0200)
bacula/src/cats/create_ingres_database.in
bacula/src/cats/drop_ingres_database.in
bacula/src/cats/drop_ingres_tables.in
bacula/src/cats/grant_ingres_privileges.in
bacula/src/cats/make_ingres_tables.in

index 1e4973de705a52006cbe0be5c9b17909a2dcd4c3..942201049232e44570e45d8496d4b776ad43406e 100755 (executable)
@@ -5,7 +5,8 @@
 
 bindir=@SQL_BINDIR@
 PATH="$bindir:$PATH"
-db_name=@db_name@
+db_name=${db_name:-@db_name@}
+db_user=${db_user:-@db_user@}
 
 # use SQL_ASCII to be able to put any filename into
 #  the database even those created with unusual character sets
@@ -21,7 +22,7 @@ ENCODING="ENCODING 'SQL_ASCII'"
 #
 #ENCODING="ENCODING 'UTF8'"
      
-if createdb $* ${db_name}
+if createdb -u${db_user} $* ${db_name}
 then
    echo "Creation of ${db_name} database succeeded."
 else
index 23c75fe287995334af042d1fbe5be4cd92d5aca7..0a4c4f7a9a07c95a9f0bd9451812104e640d4db7 100755 (executable)
@@ -4,9 +4,11 @@
 #
 
 bindir=@SQL_BINDIR@
-db_name=@db_name@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
+db_user=${db_user:-@db_user@}
 
-if destroydb ${db_name}
+if destroydb -u${db_user} ${db_name}
 then
    echo "Drop of ${db_name} database succeeded."
 else
index 10b9f3c4bdd7079716efce64b1a96eaa466a4312..08996aa3e7cca6f3910ee91edffd7a65b1b07dcb 100755 (executable)
@@ -3,8 +3,9 @@
 # shell script to delete Bacula tables for PostgreSQL
 
 bindir=@SQL_BINDIR@
-db_name=@db_name@
-db_user=@db_user@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
+db_user=${db_user:-@db_user@}
 
 sql -u${db_user} ${db_name} $* <<END-OF-DATA
 DROP TABLE filename\g
index 82bab040d4af5ca67cde4732b855acd8e25a3cad..fd87e1cfb1603925e93371e311ac48cc655a24ab 100755 (executable)
@@ -3,6 +3,7 @@
 # shell script TO GRANT privileges to the bacula database
 #
 bindir=@SQL_BINDIR@
+PATH="$bindir:$PATH"
 db_name=${db_name:-@db_name@}
 db_user=${db_user:-@db_user@}
 
@@ -11,7 +12,7 @@ CREATE USER ${db_user}
 \g
 END-OF-DATA
 
-if sql ${db_name} $* <<END-OF-DATA
+if sql -u${db_user} ${db_name} $* <<END-OF-DATA
 
 -- for tables
 GRANT ALL ON TABLE filename TO ${db_user};
index 24445df1b6e4a70893cb91f2d524bc88d85366c5..e58caa05f7981b632ad4606e1e62abe6a89615c7 100755 (executable)
@@ -5,8 +5,9 @@
 bindir=@SQL_BINDIR@
 PATH="$bindir:$PATH"
 db_name=${db_name:-@db_name@}
+db_user=${db_user:-@db_user@}
 
-sql $* ${db_name} <<END-OF-DATA
+sql -u${db_user} $* ${db_name} <<END-OF-DATA
 
 SET AUTOCOMMIT ON\g