forked from brandon15811/hudson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-recovery.sh
executable file
·89 lines (67 loc) · 1.58 KB
/
build-recovery.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
#!/usr/bin/env bash
function check_result {
if [ "0" -ne "$?" ]
then
echo $1
exit 1
fi
}
if [ -z "$HOME" ]
then
echo HOME not in environment, guessing...
export HOME=$(awk -F: -v v="$USER" '{if ($1==v) print $6}' /etc/passwd)
fi
if [ -z "$WORKSPACE" ]
then
echo WORKSPACE not specified
exit 1
fi
REPO_BRANCH=ics
if [ -z "$SYNC_PROTO" ]
then
SYNC_PROTO=http
fi
# colorization fix in Jenkins
export CL_PFX="\"\033[34m\""
export CL_INS="\"\033[32m\""
export CL_RST="\"\033[0m\""
cd $WORKSPACE
rm -rf $WORKSPACE/archive-recovery
mkdir -p $WORKSPACE/archive-recovery
export BUILD_NO=$BUILD_NUMBER
unset BUILD_NUMBER
export PATH=~/bin:$PATH
export USE_CCACHE=1
export CCACHE_NLEVELS=4
export BUILD_WITH_COLORS=0
# make sure ccache is in PATH
export PATH="$PATH:/opt/local/bin/:$PWD/prebuilt/$(uname|awk '{print tolower($0)}')-x86/ccache"
if [ -f ~/.jenkins_profile ]
then
. ~/.jenkins_profile
fi
cd $REPO_BRANCH
. build/envsetup.sh
echo DEVICE: $DEVICE
lunch cm_$DEVICE-userdebug
check_result "lunch failed."
if [ ! "$(ccache -s|grep -E 'max cache size'|awk '{print $4}')" = "20.0" ]
then
ccache -M 20G
fi
# only clobber product, not host
rm -rf out/target/product
make -j4 recoveryzip recoveryimage
check_result "Build failed."
if [ -f $OUT/utilties/update.zip ]
then
cp $OUT/utilties/update.zip $WORKSPACE/archive-recovery/recovery.zip
fi
if [ -f $OUT/recovery.img ]
then
cp $OUT/recovery.img $WORKSPACE/archive-recovery
fi
# chmod the files in case UMASK blocks permissions
chmod -R ugo+r $WORKSPACE/archive-recovery
echo This recovery was built for:
echo DEVICE: $DEVICE