forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·44 lines (34 loc) · 966 Bytes
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
cd `dirname $0`
if [ "$PREFIX" != "" ] ; then
PARENT="$PREFIX"
else
PARENT="/usr/local"
fi
TARGET_DIR="$PARENT/meteor"
# XXX try to fix it up automatically?
if [ ! -d "$PARENT" -o ! -w "$PARENT" ] ; then
echo "Can not write to $PARENT"
exit 1
elif [ -d "$PARENT/bin" -a ! -w "$PARENT/bin" ] ; then
echo "Can not write to $PARENT/bin"
exit 1
fi
echo "Installing in $PARENT"
rm -rf "$TARGET_DIR"
# make sure dev bundle exists before trying to install
./meteor --version || exit 1
cp -a dev_bundle "$TARGET_DIR"
function CPR {
tar -c --exclude .meteor/local "$1" | tar -x -C "$2"
}
cp meteor "$TARGET_DIR/bin"
CPR app "$TARGET_DIR"
CPR packages "$TARGET_DIR"
CPR examples "$TARGET_DIR"
rm -rf "$TARGET_DIR"/examples/unfinished
mkdir -p "$PARENT/bin"
rm -f "$PARENT/bin/meteor"
ln -s "$TARGET_DIR/bin/meteor" "$PARENT/bin/meteor"
# mark directory with current git sha
git rev-parse HEAD > "$TARGET_DIR/.git_version.txt"