]> git.sur5r.net Git - bacula/bacula/commitdiff
Creating a database as an other user and giving grants doesn't seem to work for Ingres.
authorMarco van Wieringen <mvw@planets.elm.net>
Sat, 3 Apr 2010 20:18:55 +0000 (22:18 +0200)
committerMarco van Wieringen <mvw@planets.elm.net>
Fri, 9 Apr 2010 11:27:17 +0000 (13:27 +0200)
Strange so for now create everything using the -u${db_user} option. This is something that
needs to be investigated as it should be possible to have an different owner of the database.

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 ac6b6eadca1b6ef898054a6a93e02cac2f09a30b..08996aa3e7cca6f3910ee91edffd7a65b1b07dcb 100755 (executable)
@@ -3,7 +3,9 @@
 # shell script to delete Bacula tables for PostgreSQL
 
 bindir=@SQL_BINDIR@
-db_name=@db_name@
+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 caeeaffddee883137ae5d5d29f44ed07e574e032..43f68d922454e71abbfacc9e7520ee4dbb66595f 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