-
Notifications
You must be signed in to change notification settings - Fork 0
/
cm7Compile.sh
executable file
·199 lines (169 loc) · 4.71 KB
/
cm7Compile.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/bin/bash
CM_DIR=/data/android/git/CM
KERN_DIR=/data/android/leo/kernels
WORKDIR=/data/android/CM
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=4608M tmpfs $SOURCE/out
echo "DONE"
}
clean()
{
echo -n "Cleaning up ... "
pushd $SOURCE > /dev/null 2>&1
make -j2 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()
{
manufacturer=$1
device=$2
echo -n "Compiling image ... "
pushd $SOURCE > /dev/null 2>&1
export CYANOGEN_NIGHTLY=1
export USE_CCACHE=1
if [[ ${device} = "leo" ]] ; then
sed -i s/developerid=cyanogenmodnightly/developerid=cyanogenmodleonightly/g vendor/cyanogen/products/common.mk
fi
cp ./vendor/cyanogen/products/cyanogen_${device}.mk buildspec.mk
cp ../out/${device}_update.zip ${device}_update.zip
echo "Getting ROMManager"
./vendor/cyanogen/get-rommanager
if [[ ${device} = "galaxys2" ]]; then
pushd device/${manufacturer}/${device} > /dev/null 2>&1
./unzip-files.sh > /dev/null 2>&1
popd > /dev/null 2>&1
fi
echo -n "setting up environment ... "
. build/envsetup.sh > /dev/null 2>&1
echo -n "running brunch ... "
lunch cyanogen_${device}-eng
make -j ${numProcs} bootimage
make -j ${numProcs} bacon
echo "DONE"
cp out/target/product/${device}/update-squished.zip $OUTPUT/update-cm7-${device}-${date1}.zip
if [[ "${device}" = "leo" ]] ; then
doPatches
createManifest
fi
rm -rf out/target/product/${device}
popd > /dev/null 2>&1
}
upload()
{
manufacturer=$1
device=$2
mkdir -p /data/httpd/cm${device}nightly/rom
cp $OUTPUT/update-cm7-${device}-${date1}.zip /data/httpd/cm${device}nightly/rom/update-cm7-${device}-${date1}.zip
pushd $OUTPUT
if [[ "${device}" = "leo" ]] ; then
echo "\$ uploadnightly ${device} ${date1} " | ftp cmleonightly1.co.cc
fi
rsync -az update-cm7-${device}-${date1}.zip arif-ali.co.uk:cmleonightly/rom/.
popd
}
createManifest()
{
MAIN=/data/dropbox/Dropbox/Public/RM.js
if [[ ! `grep CyanogenMod-7-${date2}-NIGHTLY-LEO $MAIN` ]]
then
if [[ -e $OUTPUT/update-cm7-leo-${date1}.zip ]]
then
cat > $WORKDIR/RM/new.js << EOF
{
"modversion": "CyanogenMod-7-${date2}-NIGHTLY-LEO",
"incremental": "${date1}",
"name": "CM7 - Build #${date1}",
"urls": ["http://cyanogenmod.arif-ali.co.uk/rom/update-cm7-leo-${date1}.zip",
"http://cmleonightly1.co.cc/rom/update-cm7-leo-${date1}.zip"],
"device": "leo",
"label": "CM-7",
"addons": [{
"name": "Google Apps 20110828",
"urls": ["http://goo-inside.me/gapps/gapps-gb-20110828-signed.zip"]
},
{
"name": "dtapps2sd 2.7.5.3b4",
"urls": ["http://cyanogenmod.arif-ali.co.uk/misc/dtapps2sd-2.7.5.3-beta04-signed.zip"]
},
{
"name": "3rd Party",
"urls": ["http://cyanogenmod.arif-ali.co.uk/misc/3rdParty-20111025.zip"]
},
{
"name": "CWR 5.0.2.7",
"urls": ["http://cyanogenmod.arif-ali.co.uk/recoveries/recovery_5.0.2.7_leo_CWR.zip"]
}
],
"choices": [{
"name": "Kernel",
"options": [{
"name": "charans ${date2}",
"url": "http://cyanogenmod.arif-ali.co.uk/cLK/charan_${date2}_cLK_ppp_cache.zip"
},
{
"name": "tytung r14",
"url": "http://cyanogenmod.arif-ali.co.uk/kernels/tytung_r14_charan_clk_${date1}.zip"
},
{
"name": "rafpigna 2r0",
"url": "http://cyanogenmod.arif-ali.co.uk/kernels/rafpigna_2r0_charan_clk_${date1}.zip"
},
{
"name": "marc1706 cm 0.0.04l",
"url": "http://cyanogenmod.arif-ali.co.uk/kernels/marc1706_cm_0_0_4l_charan_clk_${date1}.zip"
}
]
}],
"product": "cyanogenmodleonightly",
"summary": "${date3}"
},
EOF
cp $MAIN $MAIN.$date1
LINES=`cat $MAIN | wc -l`
CUT=$(( $LINES - 5 ))
tail -n $CUT $MAIN > /tmp/rom.js
cat $WORKDIR/RM/head.js > ${MAIN}
cat $WORKDIR/RM/new.js >> ${MAIN}
cat /tmp/rom.js >> ${MAIN}
fi
fi
}
doPatches()
{
echo -n "Building cLK and kernel patches ... "
pushd $KERN_DIR > /dev/null 2>&1
./doKernels.sh > /dev/null 2>&1
popd > /dev/null 2>&1
echo "DONE"
}
clean
devices="htc_leo samsung_galaxys2 htc_click"
for phone in `echo $devices`
do
syncDirs
manufact=`echo $phone | cut -d_ -f1`
device=`echo $phone | cut -d_ -f2`
compile $manufact $device
upload $manufact $device
clean
done