forked from Itchy-Fingerz/mobile-example-app
/
update.platform.sh
executable file
·84 lines (71 loc) · 2.09 KB
/
update.platform.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
usage() { echo "Usage: $0 -p android|ios|windows [-c]"; echo " -p -> platform, ios, android or windows (required)"; echo " -c -> cpp03 support"; 1>&2; exit 1; }
baseUrl="http://s3.amazonaws.com/eegeo-static/"
srcPackageName="INVALID"
destPackageName="./sdk.package.tar.gz"
includeDestination="INVALID"
sdkDestination="INVALID"
while getopts "p:c" o; do
case "${o}" in
p)
p=${OPTARG}
if [ "$p" != "ios" ]; then
if [ "$p" != "android" ]; then
if [ "$p" != "windows" ]; then
usage
fi
fi
fi
;;
c)
c="cpp03"
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "${p}" ]; then
usage
fi
if [ "$p" == "ios" ]; then
srcPackageName="sdk.package.ios"
includeDestination="./ios/Include/eegeo"
sdkDestination="sdk.package"
elif [ "$p" == "android" ]; then
srcPackageName="sdk.package.android"
includeDestination="./android/libs/eegeo"
sdkDestination="sdk.package.android"
elif [ "$p" == "windows" ]; then
srcPackageName="sdk.package.windows"
includeDestination="./windows/libs/eegeo"
sdkDestination="sdk.package.windows"
fi
if [[ ( "$c" == "cpp03" ) || ( "$p" == "windows" ) ]]; then
srcPackageName="$srcPackageName.tar.gz"
else
srcPackageName="$srcPackageName.cpp11.tar.gz"
fi
echo "Updating $p platform..."
rm -f ./$destPackageName
rm -rf $includeDestination
curl $baseUrl$srcPackageName > ./$destPackageName
statuscode=$?
if [ $statuscode -ne 0 ] ; then
echo "Failed to download sdk package ${baseUrl}${srcPackageName}" >&2
exit $statuscode
fi
if [ ! -d `dirname "$includeDestination"` ]; then
mkdir -p `dirname "$includeDestination"`
fi
tar -zxvf $destPackageName
if [ $? -ne 0 ] ; then
echo "Failed to unzip sdk package ${destPackageName}"
exit 1
fi
rm -f ./$destPackageName
platformVersion=`cat ./$sdkDestination/version.txt`
echo "Platform version --> $platformVersion"
echo mv ./$sdkDestination $includeDestination
mv ./$sdkDestination $includeDestination