Resending email sent in ~30/12/2018 to maintainer. I have diff for the bacula (version 9.2.2) port on OpenBSD.
The purpose of the following changes are to correct some failing logic in the shell scripts used to create a bacula database. Namely, the program will continue if it fails due to a bad password or to get the postgres version on the first 'psql' command. The last 'psql' command always attempts to login with the user name of the user that executes the script, which will usually fail when following the pkg-readme and mistakenly report 'bad encoding'. Additionally, I added some verbosity for clarity about the 3 password prompts. --- src/cats/create_postgresql_database.in.orig Tue Nov 6 09:05:08 2018 +++ src/cats/create_postgresql_database.in Sun Dec 30 23:21:02 2018 @@ -13,7 +13,15 @@ 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=`psql -d template1 -c 'select version()' $* | awk '/PostgreSQL/ {print $2}' | cut -d '.' -f 1,2` +echo "Checking version ..." +PSQLVERSION=`psql -d template1 -t -c 'show server_version;' $*` +if [ $? -ne 0 ] +then + echo " " + echo "Unable to get version. Quiting!" + echo " " + exit 1 +fi # # Note, LC_COLLATE and LC_TYPE are needed on 8.4 and beyond, but are @@ -39,6 +47,7 @@ esac # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # # +echo "Creating database ..." if psql -f - -d template1 $* <<END-OF-DATA \set ON_ERROR_STOP on CREATE DATABASE ${db_name} $ENCODING TEMPLATE template0; @@ -53,7 +62,8 @@ else echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" exit 1 fi -if psql -l | grep " ${db_name}.*SQL_ASCII" >/dev/null; then +echo "Checking encoding ..." +if psql -l $* | grep " ${db_name}.*SQL_ASCII" >/dev/null; then echo "Database encoding OK" else echo " " Regards, mmadeira