mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
They are not safe for spaces in paths. There might be other places to look for trouble.
I've run the following command to produce this commit: (on OS X, copy-and-pasting the below exactly)
find . -type f -name '*.sh' -print0 | # Find all .sh files
xargs -0 fgrep -H -- '`' | # See all places with backticks in them
fgrep 'cd `dirname $0' | # I deemed these problematic (variable assignments are safe)
cut -d ':' -f 1 | # Take the <file> from <file>:<line> produced by "grep -H"
tr '\n' '\0' | # Also here, spaces can be problematic - always do "xargs -0"!
xargs -0 -- sed -i '' 's/cd `dirname $0`/cd "`dirname "$0"`"/g'
The significance of adding the two levels of "'s can be verified by running the following in your Terminal:
$ node -e 'console.log(process.argv.splice(1))' -- `echo 1 2`
[ '1', '2' ]
$ node -e 'console.log(process.argv.splice(1))' -- "`echo 1 2`"
[ '1 2' ]
$ node -e 'console.log(process.argv.splice(1))' -- "`echo "1 2"`"
[ '1 2' ]
31 lines
864 B
Bash
Executable File
31 lines
864 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
set -u
|
|
|
|
# cd to top level dir
|
|
cd "`dirname "$0"`"
|
|
cd ../..
|
|
TOPDIR=$(pwd)
|
|
|
|
TOOLS_TMPDIR=$(mktemp -d -t meteor-build-release-XXXXXXXX)
|
|
trap 'rm -rf "$TOOLS_TMPDIR" >/dev/null 2>&1' 0
|
|
|
|
# build the tools in a temporary directory. after its built we know
|
|
# its version so rename the directory.
|
|
export TARGET_DIR="$TOOLS_TMPDIR/new"
|
|
$TOPDIR/scripts/admin/build-tools-tree.sh
|
|
TOOLS_VERSION=$(cat $TARGET_DIR/.tools_version.txt)
|
|
mv "$TARGET_DIR" "$TOOLS_TMPDIR/$TOOLS_VERSION"
|
|
|
|
# tar it up
|
|
OUTDIR="$TOPDIR/dist/tools"
|
|
mkdir -p "$OUTDIR"
|
|
|
|
TOOLS_TARBALL="$OUTDIR/meteor-tools-${TOOLS_VERSION}-${PLATFORM}.tar.gz"
|
|
echo "Tarring tools to: $TOOLS_TARBALL"
|
|
$TAR -C "$TOOLS_TMPDIR" --exclude .meteor/local -czf "$TOOLS_TARBALL" "$TOOLS_VERSION"
|
|
|
|
# A hacky (?) way to pass $TOOLS_VERSION back into build-release.sh
|
|
echo $TOOLS_VERSION > $TOPDIR/.tools_version
|