-
Notifications
You must be signed in to change notification settings - Fork 1
/
sync.sh
executable file
·68 lines (55 loc) · 1.77 KB
/
sync.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
#!/bin/bash
echo
echo "--------------------------------------"
echo " AOSP 14.0 Syncbot "
echo " by "
echo " ponces "
echo "--------------------------------------"
echo
set -e
BL=$PWD/treble_aosp
TD="android-14.0"
initRepos() {
echo "--> Getting latest upstream version"
aosp=$(curl -sL https://github.com/TrebleDroid/treble_manifest/raw/$TD/replace.xml | grep -oP "${TD}.0_r\d+" | head -1)
echo "--> Initializing workspace"
repo init -u https://android.googlesource.com/platform/manifest -b "$aosp"
echo
echo "--> Preparing local manifest"
if [ -d .repo/local_manifests ]; then
(cd .repo/local_manifests; git fetch; git reset --hard; git checkout origin/$TD)
else
git clone https://github.com/TrebleDroid/treble_manifest .repo/local_manifests -b $TD
fi
echo
}
syncRepos() {
echo "--> Syncing repos"
repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all) || repo sync -c --force-sync --no-clone-bundle --no-tags -j$(nproc --all)
echo
}
generatePatches() {
echo "--> Generating patches"
rm -rf patchestd patchestd.zip
wget -q https://github.com/TrebleDroid/treble_experimentations/raw/master/list-patches.sh -O list-patches.sh
sed -i "s/patches/patchestd/g" list-patches.sh
bash list-patches.sh
echo
}
updatePatches() {
echo "--> Updating patches"
rm -rf $BL/patches/trebledroid
unzip -q patchestd.zip
mv patchestd $BL/patches/trebledroid
echo
}
START=$(date +%s)
initRepos
syncRepos
generatePatches
updatePatches
END=$(date +%s)
ELAPSEDM=$(($(($END-$START))/60))
ELAPSEDS=$(($(($END-$START))-$ELAPSEDM*60))
echo "--> Syncbot completed in $ELAPSEDM minutes and $ELAPSEDS seconds"
echo