dspace user is not properly replaced in adapt_utilities.sql
Apparently the changes in 4f2bb34a did not work out. The perl replace line in init-dspace-db.sh does not properly replace $DSPACE_USER in utilities.sql with the value coming from the environment variable of the same name. The result is that the utilities database is incorrectly owned by the user postgres which makes some things not work. One of these is the sending of mails to new users for double-opt-in.
This is the line currently used in master
perl -pi -e 's/\$DSPACE_USER/$ENV{DSPACE_USER}/g;' /tmp/sql/utilities.sql
I also tried using
sed -i 's/$DSPACE_USER/'"$DSPACE_USER"'/' /tmp/sql/utilities.sql
Some thoughts:
- The environment variable is available at the time the script is called.
- The default shell in the container (which is used by the init script) is not bash, but sh
- Both versions above work as expected when entering the container later on using either bash or sh.