Skip to content

Commit

Permalink
Make sed do -i '' on OSX
Browse files Browse the repository at this point in the history
I don't have access to an OSX machine, so if someone could test this that would be great.

Author: Nick Lanham <[email protected]>

Closes #258 from nicklan/osx-sed-fix and squashes the following commits:

a6f158f [Nick Lanham] Also make mktemp work on OSX
558fd6e [Nick Lanham] Make sed do -i '' on OSX

(cherry picked from commit 632c322)
Signed-off-by: Matei Zaharia <[email protected]>
  • Loading branch information
nicklan authored and mateiz committed Mar 28, 2014
1 parent 3470af3 commit 4afbd19
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions make-distribution.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ if [ "$SPARK_TACHYON" == "true" ]; then
TACHYON_VERSION="0.4.1"
TACHYON_URL="https://github.com/amplab/tachyon/releases/download/v${TACHYON_VERSION}/tachyon-${TACHYON_VERSION}-bin.tar.gz"

TMPD=`mktemp -d`
TMPD=`mktemp -d 2>/dev/null || mktemp -d -t 'disttmp'`

pushd $TMPD > /dev/null
echo "Fetchting tachyon tgz"
Expand All @@ -139,7 +139,14 @@ if [ "$SPARK_TACHYON" == "true" ]; then
mkdir -p "$DISTDIR/tachyon/src/main/java/tachyon/web"
cp -r "tachyon-${TACHYON_VERSION}"/{bin,conf,libexec} "$DISTDIR/tachyon"
cp -r "tachyon-${TACHYON_VERSION}"/src/main/java/tachyon/web/resources "$DISTDIR/tachyon/src/main/java/tachyon/web"
sed -i "s|export TACHYON_JAR=\$TACHYON_HOME/target/\(.*\)|# This is set for spark's make-distribution\n export TACHYON_JAR=\$TACHYON_HOME/../../jars/\1|" "$DISTDIR/tachyon/libexec/tachyon-config.sh"

if [[ `uname -a` == Darwin* ]]; then
# osx sed wants an empty argument to -i option of sed
TACHYON_SED="sed -i ''"
else
TACHYON_SED="sed -i"
fi
$TACHYON_SED -e "s|export TACHYON_JAR=\$TACHYON_HOME/target/\(.*\)|# This is set for spark's make-distribution\n export TACHYON_JAR=\$TACHYON_HOME/../../jars/\1|" "$DISTDIR/tachyon/libexec/tachyon-config.sh"

popd > /dev/null
rm -rf $TMPD
Expand Down

0 comments on commit 4afbd19

Please sign in to comment.