Skip to content
Snippets Groups Projects
Commit 4a141fce authored by sveseli's avatar sveseli
Browse files

fixed case where db account is the same as unix account; fixed db ownership...

fixed case where db account is the same as unix account; fixed db ownership problem for dev environment
parent b35e9e62
No related branches found
No related tags found
No related merge requests found
...@@ -95,7 +95,11 @@ createDb() { ...@@ -95,7 +95,11 @@ createDb() {
echo "Creating database $DM_DB_NAME" echo "Creating database $DM_DB_NAME"
${PG_DIR}/bin/createdb -U $DM_DB_USER -h $DM_DB_HOST -p $DM_DB_PORT $DM_DB_NAME || return 1 ${PG_DIR}/bin/createdb -U $DM_DB_USER -h $DM_DB_HOST -p $DM_DB_PORT $DM_DB_NAME || return 1
echo "Creating database schema for $DM_DB_NAME" echo "Creating database schema for $DM_DB_NAME"
${PG_DIR}/bin/psql -U $DM_DB_USER -h $DM_DB_HOST -p $DM_DB_PORT -d $DM_DB_NAME -f $DB_CREATE_SCRIPT || return 1 dbCreateScript=/tmp/`basename $DB_CREATE_SCRIPT.$$`
cmd="cat $DB_CREATE_SCRIPT | sed 's?OWNER TO.*?OWNER TO $DM_DB_USER;?g' > $dbCreateScript"
eval $cmd
${PG_DIR}/bin/psql -U $DM_DB_USER -h $DM_DB_HOST -p $DM_DB_PORT -d $DM_DB_NAME -f $dbCreateScript || return 1
rm -f $dbCreateScript
touch $DB_LOCK_FILE touch $DB_LOCK_FILE
} }
...@@ -164,9 +168,12 @@ if [ -z "$DM_DB_USER_PASSWORD" ]; then ...@@ -164,9 +168,12 @@ if [ -z "$DM_DB_USER_PASSWORD" ]; then
stty $sttyOrig stty $sttyOrig
fi fi
# Create db user # Create db user unless we are running this script under the same
# account, when user will be created
echo "Creating $DM_DB_USER" echo "Creating $DM_DB_USER"
createDbUser $DM_DB_USER -E -d || exit 1 if [ $DM_DB_USER != `whoami` ]; then
createDbUser $DM_DB_USER -E -d || exit 1
fi
modifyDbUserPassword $DM_DB_USER $DM_DB_USER_PASSWORD || exit 1 modifyDbUserPassword $DM_DB_USER $DM_DB_USER_PASSWORD || exit 1
# Create db password file # Create db password file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment