-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·179 lines (157 loc) · 5.11 KB
/
build.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
#!/bin/bash
# Colors
RED="\033[1;31m" # For errors / warnings
GREEN="\033[1;32m" # For info
YELLOW="\033[1;33m" # For info
BLUE="\033[1;36m" # For info
NC="\033[0m" # reset color
# printf "${GREEN}"
# echo "
# ____ _ _ _ ____ _ _
# | __ ) _ _(_) | __| | / ___| ___ _ __(_)_ __ | |_
# | _ \| | | | | |/ _` | \___ \ / __| '__| | '_ \| __|
# | |_) | |_| | | | (_| | ___) | (__| | | | |_) | |_
# |____/ \__,_|_|_|\__,_| |____/ \___|_| |_| .__/ \__|
# |_|
# "
# echo " by @Prady"
# printf "${NC}"
printf "${GREEN}"
figlet " Build Script"
echo " by @Prady"
printf "${NC}"
cd /home/prady/derpfest
export USE_CCACHE=1
export CCACHE_EXEC=$(which ccache)
BUILD_FILE_NAME='Derp*.zip'
SCRIPT=/home/prady/MyScripts
PRODUCT_PATH=/home/prady/derpfest/out/target/product/jasmine_sprout/
BUILD_NAME=$(find D*.zip)
build_low_ram(){
cd /home/prady/derpfest
time (. build/envsetup.sh && lunch derp_jasmine_sprout-userdebug && mka api-stubs-docs && mka hiddenapi-lists-docs && mka system-api-stubs-docs && mka test-api-stubs-docs && mka kronic ) 2>&1 | tee output.log
}
build_normal(){
cd /home/prady/derpfest
time (. build/envsetup.sh && lunch derp_jasmine_sprout-userdebug && mka kronic) 2>&1 | tee output.log
}
notif_start(){
telegram-send --format markdown "*DerpFest* build started for *jasmeme* at *$(date +%X)*"
}
notif_done(){
#telegram-send --format markdown "*DerpFest* build completed for *jasmeme* at *$(date +%X)*"
telegram-send --file output.log --caption "DerpFest build completed for jasmeme at $(date +%X)"
}
notif_upload_sf(){
telegram-send "Uploading completed to SF at $(date +%X), visit https://sourceforge.net/projects/derpfest/files/jasmine_sprout/"
echo "Uploading ${BUILD_NAME} finished."
}
notif_upload_gdrive(){
telegram-send --format markdown "Uploading completed to *GDRIVE* at *$(date +%X)*, visit https://drive.google.com/open?id=1MfBUuktApHZqvtd2qfbcSUNmmmfw4Q3L"
echo "Uploading ${BUILD_NAME} finished."
}
echo ""
echo -e "${YELLOW}Choose any Option :${NC}"
echo -e " ${GREEN}1${NC} ${BLUE}Re-sync sauce${NC}"
echo -e " ${GREEN}2${NC} ${BLUE}Start building rom${NC}"
echo -e " ${GREEN}3${NC} ${BLUE}Start CLEANUP${NC}"
echo -e " ${GREEN}4${NC} ${BLUE}Open target device folder${NC}"
echo -e " ${GREEN}5${NC} ${BLUE}Start fetch script${NC}"
echo -e " ${GREEN}6${NC} ${BLUE}Start kernel script${NC}"
echo -e " ${GREEN}7${NC} ${BLUE}Flash karamel${NC}"
echo -e " ${GREEN}8${NC} ${BLUE}Upload Build [SF/Gdrive]${NC}"
read base
if [ $base = 1 ]
then
echo -e "${GREEN}Starting Sync...${NC}"
#time repo sync -j$(nproc --all) --force-sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-broken
time repo sync -j4 --force-sync -c --no-clone-bundle --no-tags --optimized-fetch --prune --force-broken
echo -e "${YELLOW}Done!${NC}"
fi
if [ $base = 2 ]
then
building(){
echo -e "${YELLOW}Low Ram Hack?${NC} ${RED}{y/n}${NC}"
read base
if [[ $base = 'y' ]];then
echo -e "${GREEN}Starting Build...${NC}"
notif_start
build_low_ram
else
echo -e "${GREEN}Starting Build...${NC}"
notif_start
build_normal
fi
}
echo -e "${YELLOW}Wipe product DIR?${NC} ${RED}{y/n}${NC}"
read base
if [[ $base = 'y' ]];then
echo -e "${YELLOW}Wiping product DIR${NC}"
rm -rf /home/prady/derpfest/out/target/product/jasmine_sprout
echo -e "${GREEN}Done!${NC}"
building
else
building
fi
echo -e "${GREEN}Done!${NC}"
notif_done
fi
if [ $base = 3 ]
then
echo -e "${YELLOW}Full clean?${NC} ${RED}{y/n}${NC}"
read base
if [[ $base = 'y' ]];then
echo -e "${GREEN}Starting full clean...${NC}"
time make clean && make clobber
else
echo -e "${GREEN}Starting partial clean...${NC}"
time make installclean
fi
echo -e "${YELLOW}Done!${NC}"
fi
if [ $base = 4 ]
then
nemo out/target/product/jasmine_sprout
echo -e "${YELLOW}Done!${NC}"
fi
if [ $base = 5 ]
then
cd ${SCRIPT} && ./fetch.sh
fi
if [ $base = 6 ]
then
echo -e "${GREEN}Starting Script...${NC}"
cd ${SCRIPT} && ./kernel.sh
fi
if [ $base = 7 ]
then
cd ${SCRIPT} && ./flash.sh
fi
if [ $base = 8 ]
then
echo -e "${YELLOW}Upload to SF?${NC} ${RED}{y/n}${NC}"
read base
if [[ $base = 'y' ]];then
echo "Uploading ${BUILD_NAME} to SF"
cd ${SCRIPT} && ./telegram "Uploading build to SF started at $(date +%X)"
cd ${PRODUCT_PATH}
pwd
echo "Sftp ${BUILD_NAME} [y/n]"
read base
if [[ $base = 'y' ]];then
sftp [email protected]
# cd /home/frs/project/derpfest/jasmine_sprout
# put ${BUILD_FILE_NAME}
else
scp ${BUILD_FILE_NAME} [email protected]:/home/frs/project/derpfest/jasmine_sprout
fi
notif_upload_sf
else
telegram-send "Uploading build to GDRIVE started at $(date +%X)"
cd ${PRODUCT_PATH}
pwd
echo "Uploading ${BUILD_NAME} to GDRIVE"
rclone copy --update --verbose --checkers 8 --retries 3 --low-level-retries 10 --stats 1s ${BUILD_FILE_NAME} "gdrive:mia2/rclone"
notif_upload_gdrive
fi
fi