-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinstall_phonegap.sh
executable file
·90 lines (64 loc) · 2.06 KB
/
install_phonegap.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
SCRIPT_NAME=$(basename $BASH_SOURCE)
SCRIPT_LOGFILE="./logs/"$(basename -s .sh $BASH_SOURCE)".log"
SCRIPT_ENVFILE="./logs/"$(basename -s .sh $BASH_SOURCE)".env"
mkdir -p ./logs && chmod 755 ./logs
echo "running "$SCRIPT_NAME
# tested: works on ubuntu 14.04.3 gnome
# see http://dasunhegoda.com/installrun-phonegap-ubuntu/797/
# see http://cordova.apache.org/docs/en/5.0.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide
# checking nodejs
if hash node 2>/dev/null; then
echo " checking node => ok"
else
echo " checking node => node not installed, please install it and retry"
exit;
fi
# checking npm
if hash npm 2>/dev/null; then
echo " checking npm => ok"
else
echo " checking npm => npm not installed, please install it and retry"
exit;
fi
# checking jdk
# todo: better check for jdk
if hash javac 2>/dev/null; then
echo " checking jdk => ok"
else
echo " checking jdk => jdk not installed, please install it and retry"
exit;
fi
# checking git
if hash git 2>/dev/null; then
echo " checking git => ok"
else
echo " checking git => git installing git"
sudo apt-get -y install git &>> $SCRIPT_LOGFILE
fi
# checking ant
if hash ant 2>/dev/null; then
echo " checking ant => ok"
else
echo " checking ant => installing ant"
sudo apt-get -y install ant &>> $SCRIPT_LOGFILE
fi
if hash phonegap 2>/dev/null; then
echo " phonegap already installed"
else
echo " phonegap not installed => installing phonegap"
# install dependencies
sudo apt-get -y install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6 &>> $SCRIPT_LOGFILE
#
npm install -g phonegap &>> $SCRIPT_LOGFILE
npm install -g plugman &>> $SCRIPT_LOGFILE
# tips
echo " NOTE: you will probably need to install a new version of android sdk using 'Android SDK Manager' before using cordova"
echo ""
echo " Here is how to run a hello world on your device:"
echo " cd ~/Desktop && phonegap create hello2 com.example.hello HelloWorld && cd hello2"
echo " phonegap platform add android"
echo " phonegap build android"
echo " phonegap run android --device"
echo ""
fi