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

Commit

Permalink
Adding BASE_DIR to the files being shebang aware
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthkumar committed Aug 8, 2016
1 parent d2093d8 commit 8a6e04d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mesos-fix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ APP_PATH=${APP_PATH:-/app/}
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
# Add after the shebang in the file
sed -i '/#\!/a export BASE_PATH=$(cd `dirname $BASH_SOURCE`; pwd -P)/../' $FILE
# Add to the BOF if shebang is not present
egrep "#\!" $FILE || sed -i '1i export BASE_PATH=$(cd `dirname $BASH_SOURCE`; pwd -P)/../' $FILE
fi
}

Expand Down

0 comments on commit 8a6e04d

Please sign in to comment.