forked from robterrell/cocos2d-javascript
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·55 lines (37 loc) · 1.06 KB
/
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
45
46
47
48
49
50
51
52
53
#!/bin/sh
if which npm &> /dev/null
then
echo "NPM is installed. You should probably install cocos2d-javascript as an npm package using this command instead:\n npm install .\n"
read -p "Continue anyway? (y/n) : " yn
case $yn in
[Nn]* ) exit;;
[Yy]* ) break;;
* ) echo "Enter 'y' or 'n'"
esac
fi
DIR=`dirname $0`
read -p "Where should I install to? (/usr/local/cocos2d-javascript/) : " install_to
if [ -z "$install_to" ]
then
install_to='/usr/local/cocos2d-javascript/'
fi
echo "Installing to: $install_to"
mkdir -p "$install_to"
cd $DIR
IFS=$'\n'
for file in `find * \( ! -regex '.*/\..*' \) -type f`
do
dst="$install_to/$file"
dst_dir=`dirname "$dst"`
if [ ! -d "$dst_dir" ]
then
mkdir -p "$dst_dir"
fi
cp "$file" "$dst"
done
cd -
echo "All files copied."
ln -s "$install_to/bin/cocos.sh" "/usr/local/bin/cocos"
echo "Symlinked 'cocos' executable to /usr/local/bin/cocos\n"
echo "Installation complete\n\n"
echo "You should now be able to type 'cocos' and get a list of available commands."