Via experimentation, I think it's safe to say that at the moment, the OpenShift software overrides the "usual suspects" (e.g. PATH, PS1, HOME) after it reads your .bash_profile. In order to customize your prompt (and any other environment settings), you need to manually execute a shell script (e.g. as soon as you log in). Therefore, my solution was to:
- Create a shell script (e.g. fixShell.sh) in your $OPENSHIFT_DATA_DIR with all your changes:
export HOME="${HOME%/}"
export PS1="\w > "
export TMOUT=3600
unset TMOUT
- Print a reminder every time to manually execute the above script, so change .bash_profile to echo a colorful reminder:
COL_BLUE="\x1b[34;01m"
COL_RESET="\x1b[39;49;00m"
echo
echo -e $COL_BLUE"COMMAND TO EXECUTE FOR PROPER CONFIGURATION OF ENVIRONMENT:"$COL_RESET
echo
echo "source app-root/data/fixShell.sh"
The reason the default prompt doesn't abbreviate the home directory correctly is because the HOME variable contains a trailing slash ('/'), which once removed, works correctly in the prompt. Coincidentally, there's a trailing slash in all the $OPENSHIFT_* directory-related variables.