-
Notifications
You must be signed in to change notification settings - Fork 4
/
check_dependencies.sh
executable file
·65 lines (50 loc) · 1.15 KB
/
check_dependencies.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
#!/bin/sh
## Author : [email protected]
## Date : 19th,Oct. 2010
check()
{
if [ `cat ./temporary_file | grep "ii[\ ]*$1\ " | wc -l` -eq 0 ] ; then
echo " $1";
fi
}
verify()
{
packages="$packages$(check $1)";
}
verifyEither()
{
FOUND="no"
for pack in $*; do
locPack=$(check $pack)
if [ -z $locPack ]; then
FOUND="yes"
fi
done
if [ "$FOUND" = "no" ]; then
packages="$packages $1"
fi
}
packages="";
if [ `which uname` ] ; then
if [ `uname -a | grep Ubuntu | wc -l` ] ; then
echo "\033[31mChecking required Ubuntu packages ...\033[0m";
if [ ! -e ./temporary_file ] ; then # check that the temp file does not exist
dpkg -l > ./temporary_file;
#To build the android app
verifyEither "openjdk-6-jdk" "sun-java6-jdk";
verify "ant";
verify "rpl";
if [ "$packages" != "" ] ; then
echo "You should install the following packages to compile the Mykonos project with Ubuntu:\n $packages";
echo "Do you want to install them now [y/n] ?";
read user_answer ;
if [ "$user_answer" = "y" ]; then
sudo apt-get install $packages;
fi
else
echo "ok.";
fi
rm ./temporary_file;
fi
fi
fi