X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fcats%2Fcreate_postgresql_database.in;h=50fe6c4bf06509f58f9f35e7d8af706f51ba1d80;hb=fb71554fa28e81b6125c2063e028976df18334f2;hp=38f793c3e457f3ba10e883d8cd334426f8dee5e4;hpb=d0f581b9e3a003aa2e0093a81e0790ece6b8bed2;p=bacula%2Fbacula diff --git a/bacula/src/cats/create_postgresql_database.in b/bacula/src/cats/create_postgresql_database.in index 38f793c3e4..50fe6c4bf0 100644 --- a/bacula/src/cats/create_postgresql_database.in +++ b/bacula/src/cats/create_postgresql_database.in @@ -3,14 +3,14 @@ # shell script to create Bacula database(s) # -bindir=@SQL_BINDIR@ -db_name=@db_name@ +PATH="@SQL_BINDIR@:$PATH" +db_name=${db_name:-@db_name@} # # use SQL_ASCII to be able to put any filename into # the database even those created with unusual character sets -PSQLVERSION=`$bindir/psql -d template1 -c 'select version()' | head -n1 | cut -d ' ' -f 2 | cut -d '.' -f 1,2` +PSQLVERSION=`psql -d template1 -c 'select version()' | awk '/PostgreSQL/ {print $2}' | cut -d '.' -f 1,2` # # Note, LC_COLLATE and LC_TYPE are needed on 8.4 and beyond, but are @@ -39,7 +39,7 @@ esac # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # # -if $bindir/psql -f - -d template1 $* </dev/null; then +if psql -l ${dbname} | grep " ${db_name}.*SQL_ASCII" >/dev/null; then echo "Database encoding OK" else echo " "