forked from Octo-Kat/jet
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbscript.sh
More file actions
executable file
·79 lines (70 loc) · 2.12 KB
/
Copy pathbscript.sh
File metadata and controls
executable file
·79 lines (70 loc) · 2.12 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
#!/bin/bash
## Build Automation Scripts
##
## Copywrite 2014 - Donald Hoskins <grommish@gmail.com>
## on behalf of Team Octos et al.
PUSH=$1
BSPEED=$2
: ${PUSH:=false}
: ${BSPEED:="21"}
BVARIANT=$3
source build/envsetup.sh
source jet/credentials.sh
echo "Setting Lunch Menu to ${BVARIANT}"
lunch oct_${BVARIANT}-userdebug
## Clean Up Previous Builds as well as old md5sum files
make installclean && rm -rf out/target/product/*/*md5sum
## Current Build Date
BDATE=`date +%m-%d`
if [ $1 = "y" ]; then
PUSH=true
else
PUSH=false
fi
if [ ! -d "${COPY_DIR}/${BDATE}" ]; then
echo "Creating directory for ${COPY_DIR}/${BDATE}"
mkdir -p ${COPY_DIR}/${BDATE}
chmod 775 ${COPY_DIR}/${BDATE}
fi
echo "Starting brunch with ${BSPEED} threads for ${COPY_DIR}"
if ${PUSH}; then
echo "Pushing to Remote after build!"
fi
# Build command
brunch ${BVARIANT} -j${BSPEED}
find ${OUT} '(' -name 'Oct*' -size +150000 ')' -print0 |
xargs --null md5sum |
while read CHECKSUM FILENAME
do
if [ ${FILENAME} == "-" ]; then
echo "Borked Build"
else
if ! $PUSH; then
echo "Moving to Copybox"
cp ${FILENAME} ${COPY_DIR}/${BDATE}/${FILENAME##*/}
cp "${FILENAME}.md5sum" ${COPY_DIR}/${BDATE}/${FILENAME##*/}.md5
fi
OTAFILE=`basename ${FILENAME} | cut -f 1 -d '.'`
echo "Filename ${FILENAME} - OTAFILE: ${OTAFILE}"
if ${PUSH}; then
if [ -e ota.xml ]; then
echo "Cleaning old OTA manifest"
rm ota.xml
fi
echo "Pulling OTA manifest"
wget http://www.teamoctos.com/ota.xml
echo "Updating manifest for ${OTAFILE}"
sed -i "s/Oct-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]-${BVARIANT}/${OTAFILE}/g" ota.xml
echo "Removing existing file from remote."
sleep 2
ssh -2 ${RACF}@${RHOST} "rm -rf ${ROUT}/${BVARIANT}/*.zip" < /dev/null
sleep 2
echo "Pushing new file ${OTAFILE} to remote"
scp -2 ${FILENAME} ${RACF}@${RHOST}:${ROUT}/${BVARIANT}
echo "Pushing new OTA manifest to remote"
scp -2 ota.xml ${RACF}@${RHOST}:public_html/ota.xml
echo "Triggering Sync"
curl ${RSYNC}
fi
fi
done