Skip to content

Commit 632c322

Browse files
nicklanmateiz
authored andcommitted
Make sed do -i '' on OSX
I don't have access to an OSX machine, so if someone could test this that would be great. Author: Nick Lanham <nick@afternight.org> 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
1 parent 3d89043 commit 632c322

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

make-distribution.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ if [ "$SPARK_TACHYON" == "true" ]; then
128128
TACHYON_VERSION="0.4.1"
129129
TACHYON_URL="https://github.com/amplab/tachyon/releases/download/v${TACHYON_VERSION}/tachyon-${TACHYON_VERSION}-bin.tar.gz"
130130

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

133133
pushd $TMPD > /dev/null
134134
echo "Fetchting tachyon tgz"
@@ -139,7 +139,14 @@ if [ "$SPARK_TACHYON" == "true" ]; then
139139
mkdir -p "$DISTDIR/tachyon/src/main/java/tachyon/web"
140140
cp -r "tachyon-${TACHYON_VERSION}"/{bin,conf,libexec} "$DISTDIR/tachyon"
141141
cp -r "tachyon-${TACHYON_VERSION}"/src/main/java/tachyon/web/resources "$DISTDIR/tachyon/src/main/java/tachyon/web"
142-
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"
142+
143+
if [[ `uname -a` == Darwin* ]]; then
144+
# osx sed wants an empty argument to -i option of sed
145+
TACHYON_SED="sed -i ''"
146+
else
147+
TACHYON_SED="sed -i"
148+
fi
149+
$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"
143150

144151
popd > /dev/null
145152
rm -rf $TMPD

0 commit comments

Comments
 (0)