forked from avary/android-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cm9Compile.sh
executable file
·120 lines (91 loc) · 2.83 KB
/
cm9Compile.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
CM_DIR=/data/android/git/CM-ics
WORKDIR=/data/android/CM-ics
OUTPUT=$WORKDIR/out
SOURCE=$WORKDIR/source
date1=`date +%Y%m%d`
date2=`date +%m%d%Y`
date3=`date +%m-%d-%Y`
numProcs=$(( `cat /proc/cpuinfo | grep processor | wc -l` + 1 ))
mkdir -p $OUTPUT
mkdir -p $SOURCE
export PATH=/data/andriodsdk/platform-tools:$PATH
export PATH=/data/andriodsdk/tools:$PATH
export USER=$LOGNAME
syncDirs()
{
echo -n "Synchronising directories ... "
mkdir -p $SOURCE
rsync -a --del $CM_DIR/* $SOURCE/.
mkdir $SOURCE/out
mount -t tmpfs -o size=13312M tmpfs $SOURCE/out
echo "DONE"
}
clean()
{
echo -n "Cleaning up ... "
pushd $SOURCE > /dev/null 2>&1
make -j5 clean dataclean installclean > /dev/null 2>&1
rm -rf out/* > /dev/null 2>&1
umount out > /dev/null 2>&1
popd > /dev/null 2>&1
#rm -rf $SOURCE > /dev/null 2>&1
echo "DONE"
}
compile()
{
device=$1
clean
syncDirs
echo -n "Compiling image ... "
pushd $SOURCE > /dev/null 2>&1
export CM_NIGHTLY=1
export USE_CCACHE=1
sed -i s/developerid=cyanogenmodnightly/developerid=cyanogenmodleonightly/g vendor/cyanogen/products/common.mk
echo "Getting ROMManager"
pushd vendor/cm/ > /dev/null 2>&1
./get-prebuilts
popd > /dev/null 2>&1
echo -n "setting up environment ... "
. build/envsetup.sh > /dev/null 2>&1
echo -n "running brunch ... "
lunch cm_${device}-eng
make -j ${numProcs} bootimage
make -j ${numProcs} bacon
echo "DONE"
release=""
if [[ "$device" == "leo" ]]
then
release="-magldr"
fi
cp out/target/product/${device}/update-cm-nightly-signed.zip $OUTPUT/update-cm9-${device}${release}-${date1}.zip
cp out/target/product/${device}/update-cm-nightly-signed.zip /var/www/update-cm9-${device}${release}-${date1}.zip
if [[ "$device" == "leo" ]]
then
release="-clk"
sed -i 's/\(^TARGET_CUSTOM_RELEASETOOL.*\)/#\1/g' device/htc/${device}/BoardConfig.mk
make -j 5 bacon
cp out/target/product/${device}/update-cm-9-*-NIGHTLY-*-signed.zip $OUTPUT/update-cm9-${device}${release}-${date1}.zip
cp out/target/product/${device}/update-cm-9-*-NIGHTLY-*-signed.zip /var/www/update-cm9-${device}${release}-${date1}.zip
fi
popd > /dev/null 2>&1
}
upload()
{
device=$1
release=""
if [[ "$device" == "leo" ]]
then
release="-magldr"
fi
cp $OUTPUT/update-cm9-${device}${release}-${date1}.zip /data/httpd/cm${device}nightly/rom/update-cm9-${device}${release}-${date1}.zip
rsync -az $OUTPUT/update-cm9-${device}${release}-${date1}.zip arif-ali.co.uk:cmleonightly/rom/test/.
if [[ "$device" == "leo" ]]
then
release="-clk"
cp $OUTPUT/update-cm9-${device}${release}-${date1}.zip /data/httpd/cm${device}nightly/rom/update-cm9-${device}${release}-${date1}.zip
rsync -az $OUTPUT/update-cm9-${device}${release}-${date1}.zip arif-ali.co.uk:cmleonightly/rom/test/.
fi
}
compile leo
upload leo