Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Commit

Permalink
Updating BASE_PATH in all .profile.d/* scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthkumar committed Aug 7, 2016
1 parent 20784cc commit d2093d8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mesos-fix
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ set -e

APP_PATH=${APP_PATH:-/app/}

if [ -f ${APP_PATH}/.profile.d/python.sh ]; then
sed -i '1i export BASE_PATH=$(cd `dirname $BASH_SOURCE`; pwd -P)/../' ${APP_PATH}/.profile.d/python.sh
add_base_path_on_top_in() {
FILE=$1
if [ -f $FILE ]; then
sed -i '1i export BASE_PATH=$(cd `dirname $BASH_SOURCE`; pwd -P)/../' $FILE
fi
}

if [ -f ${APP_PATH}/.profile.d/python.sh ]; then
sed -i 's/#!\/app\/.heroku\/python\/bin\/python/#!\/usr\/bin\/env python/' ${APP_PATH}/.heroku/python/bin/*
fi

# Update all scripts in .profile.d/
for script in `ls ${APP_PATH}/.profile.d/*`;
do
add_base_path_on_top_in $script
sed -i 's/\/app\//\$\{BASE_PATH\}\//g' $script
sed -i 's/\$HOME/\$\{BASE_PATH\}/g' $script
done
Expand Down

0 comments on commit d2093d8

Please sign in to comment.