Skip to content

Commit

Permalink
Improved installer compatibility for EDBAS that .enterprisedb_profile…
Browse files Browse the repository at this point in the history
… is created instead of .pgsql_profile. Fixes #14.
  • Loading branch information
rolandstirnimann committed Apr 21, 2023
1 parent a5c3b79 commit 7ddd0c2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bundle/install_pgbasenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,24 +138,24 @@ set -- \"\${args[@]}\"
" > $HOME/.pgbasenv_profile
[[ $? -gt 0 ]] && echo "ERROR: Cannot continue! Failed to create \$HOME/.pgbasenv_profile." && exit 1 || echo "SUCCESS"

[[ $USER == "enterprisedb" ]] && PROFILE_FILE=".enterprisedb_profile" || PROFILE_FILE=".pgsql_profile"
echo -e "\n>>> INSTALLATION STEP: Update $HOME/$PROFILE_FILE.\n"

echo -e "\n>>> INSTALLATION STEP: Update $HOME/.pgsql_profile.\n"

if [[ -f $HOME/.pgsql_profile ]]; then
cp $HOME/.pgsql_profile $HOME/.pgsql_profile.bak
[[ $? -eq 0 ]] && echo "Backup created in $HOME/.pgsql_profile.bak" || exit 1
if [[ -f $HOME/$PROFILE_FILE ]]; then
cp $HOME/$PROFILE_FILE $HOME/$PROFILE_FILE.bak
[[ $? -eq 0 ]] && echo "Backup created in $HOME/$PROFILE_FILE.bak" || exit 1
else
touch $HOME/.pgsql_profile
touch $HOME/$PROFILE_FILE
fi

# Remove from .bash_profile
sed -i.bak '/pgBasEnv/d' $HOME/.bash_profile
sed -i.bak '/pgbasenv_profile/d' $HOME/.bash_profile

sed -i.bak '/pgBasEnv/d' $HOME/.pgsql_profile
sed -i.bak '/pgbasenv_profile/d' $HOME/.pgsql_profile
echo "# Added by pgBasEnv installer" >> $HOME/.pgsql_profile
echo "[[ -f ~/.pgbasenv_profile ]] && source ~/.pgbasenv_profile && pgup && pgsetenvsta --default" >> $HOME/.pgsql_profile
sed -i.bak '/pgBasEnv/d' $HOME/$PROFILE_FILE
sed -i.bak '/pgbasenv_profile/d' $HOME/$PROFILE_FILE
echo "# Added by pgBasEnv installer" >> $HOME/$PROFILE_FILE
echo "[[ -f ~/.pgbasenv_profile ]] && source ~/.pgbasenv_profile && pgup && pgsetenvsta --default" >> $HOME/$PROFILE_FILE
[[ $? -eq 0 ]] && echo "SUCCESS" || exit 1


Expand Down

0 comments on commit 7ddd0c2

Please sign in to comment.