-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-twrp.sh
More file actions
88 lines (76 loc) · 2.09 KB
/
build-twrp.sh
File metadata and controls
88 lines (76 loc) · 2.09 KB
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
#!/bin/bash
#
# Copyright (c) 2017 - 2018 TeamWin Recovery | MediaTek
# https://github.com/twrp-mtk
#
# Don't touch this
DEVICE="$1"
LOG="$2"
CLEAN="$3"
ARG_COUNT="$#"
if [ $ARG_COUNT -lt "3" ]
then
echo "Not enough arguments were specified, run the script again with proper arguments"
exit 1
fi
export TW_DEVICE_VERSION="0"
export VERSION=$( grep "TW_MAIN_VERSION_STR" bootable/recovery/variables.h -m 1 | cut -d \" -f2 )-${TW_DEVICE_VERSION}
export OUT_LOG="twrp-${VERSION}-${DEVICE}.log"
export OUT_PATH="out/target/product/${DEVICE}"
export OUT_RECOVERY_IMAGE="twrp-${VERSION}-${DEVICE}.img"
# Clean build
if [ "$CLEAN" == "--clean" ]
then
make clean
fi
# Setting the build environment
source build/envsetup.sh
# Setting the device
lunch omni_${DEVICE}-eng
# Building the TWRP
if [ "$LOG" == "--log" ]
then
mka recoveryimage | tee -a ${OUT_LOG}
else
mka recoveryimage
fi
# Checking if the build was successful
cd ${OUT_PATH}
if [ -f "recovery.img" ]
then
mv recovery.img ${OUT_RECOVERY_IMAGE}
cd ../../../..
echo ""
echo "******************************************************************************"
echo ""
echo " TeamWin Recovery ${VERSION} has been successfuly built for device ${DEVICE}!"
echo ""
echo " TeamWin Recovery version : ${VERSION}"
echo " TeamWin Recovery image : $OUT_PATH/${OUT_RECOVERY_IMAGE}"
if [ "$LOG" == "--log" ]
then
echo " Build log : ${OUT_LOG}"
fi
echo ""
echo "******************************************************************************"
echo ""
else
rm ${OUT_LOG}
make clean
echo ""
echo "********************************************************************************"
echo " Something went wrong during the build process, try checking your device tree."
echo " After that, run the script again and see if you messed up something new or not."
echo "********************************************************************************"
echo ""
fi
# Unsetting variables
unset TW_DEVICE_VERSION
unset DEVICE
unset VERSION
unset OUT_PATH
unset OUT_LOG
unset OUT_RECOVERY_IMAGE
unset LOG
unset CLEAN
unset ARG_COUNT