-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewBuild.sh
More file actions
executable file
·58 lines (52 loc) · 1.47 KB
/
newBuild.sh
File metadata and controls
executable file
·58 lines (52 loc) · 1.47 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
#!/bin/bash -e
if [ -z ${cmHome+x} ]; then
if [ ! -z "$1" ]; then
export cmHome=$1/cm14.1
echo "A new build will be started on $cmHome"
else
read -p "Where do you want to start the build: " -e dir
cmHome=$dir/cm14.1
fi
fi
if [ -d "$cmHome" ]; then
echo "A build already exists there."
while true; do
read -p "Do you wish to replace it with a new one? [y/n]" yn
case $yn in
[Yy]* ) echo "Removing old one..."
rm -rf $cmHome
echo "Done."
echo "Old build removed."
echo "Starting new build..."
mkdir -p $cmHome
break;;
[Nn]* ) echo "Exiting..."
exit 0;;
* ) echo "Please answer yes or no.";;
esac
done
else
echo "Starting new build..."
mkdir -p $cmHome
fi
securegen="$(dirname "$(pwd)")"
cd $cmHome
echo "Initiating repo sync - `date +%x` `date +%T`" | tee -a log.txt
repo init -u https://github.com/LineageOS/android.git -b cm-14.1
#Add FDroidPrivilegedExtension repo
mkdir $cmHome/.repo/local_manifests/
cp $securegen/scripts/manifests/FDroidPrivilegedExtension.xml $cmHome/.repo/local_manifests/
for i in {0..5}; do
repo sync
if [ $? = 0 ]; then
echo -e "Repo sync completed - `date +%x` `date +%T`\n" | tee -a log.txt
echo "New build started at $cmHome."
exit 0
fi
echo -e "\tRepo sync failed - `date +%x` `date +%T`" | tee -a log.txt
if [ $i -lt 5 ]; then
echo -e "\tTrying repo sync again- `date +%x` `date +%T`" | tee -a log.txt
fi
done
echo "Exiting due too many fails - `date +%x` `date +%T`\n" | tee -a log.txt
exit 1