-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPureMenu.sh
executable file
·152 lines (138 loc) · 4.64 KB
/
PureMenu.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
#!/bin/bash
#
# Copyright (C) 2016 BeansTown106 for PureNexus Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Variables
OUTDIR=~/android/Completed
SOURCE=~/android/aosp/pure
FTPSERVER=uploads.androidfilehost.com
LOGIN=BeansTown106
PASSWORD=password
# Colors
green=`tput setaf 2`
red=`tput setaf 1`
yellow=`tput setaf 3`
reset=`tput sgr0`
#functions
release() {
# Prepare build environment, sync the repo, and clean the out directory
export PURE_BUILD_TYPE=OFFICIAL
cd ${SOURCE}
source build/envsetup.sh
repo sync -j8
mka clean
# Build the below devices
DEVICES="angler bullhead dragon marlin sailfish shamu"
for DEVICE in ${DEVICES}
do
brunch ${DEVICE}
mv ${SOURCE}/out/target/product/${DEVICE}/purenexus_${DEVICE}-*.zip ${OUTDIR}
mka clean
done
}
upload() {
cd ${OUTDIR}
lftp <<INPUT_END
open sftp://$FTPSERVER
user $LOGIN $PASSWORD
set sftp:auto-confirm yes
mput *.*
exit
INPUT_END
}
testbuilds() {
# Prepare build environment, sync the repo, and clean the out directory
export PURE_BUILD_TYPE=TEST
cd ${SOURCE}
source build/envsetup.sh
repo sync -j8
mka clean
# Build the below devices
DEVICES="angler marlin shamu"
for DEVICE in ${DEVICES}
do
brunch ${DEVICE}
mv ${SOURCE}/out/target/product/${DEVICE}/purenexus_${DEVICE}-*.zip ${OUTDIR}
mka clean
done
}
# ----------------------------------------------------------
menu=
until [ "$menu" = "0" ]; do
echo ""
echo "${red}=========================================================${reset}"
echo "${red}==${reset}${green} Pure Release Script ${reset}${red}==${reset}"
echo "${red}==${reset}${green} Lets get Ready To Build For The Masses! ${reset}${red}==${reset}"
echo "${red}=========================================================${reset}"
echo "${red}==${reset}${yellow} 1 - Full Release and Upload ${reset}${red}==${reset}"
echo "${red}==${reset}${yellow} 2 - Full Release without Upload ${reset}${red}==${reset}"
echo "${red}==${reset}${yellow} 3 - Build Pixel XL/N6/6P Test Builds ${reset}${red}==${reset}"
echo "${red}==${reset}${yellow} 4 - Upload all files in Out Directory ${reset}${red}==${reset}"
echo "${red}==${reset}${yellow} 5 - Delete all files in Out Directory ${reset}${red}==${reset}"
echo "${red}==${reset}${yellow} 0 - Exit ${reset}${red}==${reset}"
echo "${red}=========================================================${reset}"
echo ""
echo -n "Enter selection: "
read menu
echo ""
case ${menu} in
1 )
# Full release and upload
BEGIN=$(date +%s)
release
upload
END=$(date +%s)
echo "${green}Full Release and Upload Complete!!${reset}"
echo "${green}Total time elapsed: $(echo $((${END}-${BEGIN})) | awk '{print int($1/60)"mins "int($1%60)"secs "}')${reset}"
;;
#############################################################
2 )
# Full release local
BEGIN=$(date +%s)
release
END=$(date +%s)
echo "${green}Full Release Complete!!${reset}"
echo "${green}Total time elapsed: $(echo $((${END}-${BEGIN})) | awk '{print int($1/60)"mins "int($1%60)"secs "}')${reset}"
;;
#############################################################
3 )
# Build Angler/Shamu Test Builds
BEGIN=$(date +%s)
testbuilds
END=$(date +%s)
echo "${green}Test Builds Complete!!${reset}"
echo "${green}Total time elapsed: $(echo $((${END}-${BEGIN})) | awk '{print int($1/60)"mins "int($1%60)"secs "}')${reset}"
;;
#############################################################
4 )
# Upload OUTDIR
BEGIN=$(date +%s)
upload
END=$(date +%s)
echo "${green}OUTDIR Upload Complete!!${reset}"
echo "${green}Total time elapsed: $(echo $((${END}-${BEGIN})) | awk '{print int($1/60)"mins "int($1%60)"secs "}')${reset}"
;;
#############################################################
5 )
# Wipe contents of OUTDIR
rm -rf ${OUTDIR}/*
echo "${green}Wiped OUTDIR!!${reset}"
;;
#############################################################
0 ) exit ;;
* ) echo "Wrong Choice Asshole, 1-7 or 0 to exit"
esac
done
;;
#############################################################