-
Notifications
You must be signed in to change notification settings - Fork 1
/
vendorsetup.sh
90 lines (72 loc) · 2.76 KB
/
vendorsetup.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
#!/bin/bash
TOP=$(pwd)
PATCHES=$TOP/device/phh/treble/patches
RESET=true
function patch() {
cd $TOP/$2
if $RESET; then
git am --abort
git reset --hard FETCH_HEAD
fi
#git config --local user.name "generic"
#git config --local user.email "[email protected]"
git am $FOLDER/*
if [ $? -ne 0 ]; then
echo "!!! WARNING: Patching failed."
fi
#git config --local --unset user.name
#git config --local --unset user.email
}
function apply() {
for FOLDER in $PATCHES/$1/*; do
PATCHDIR=$(basename "$FOLDER") # Remove additional path from DIR name
SOURCEPATH=${PATCHDIR/platform_/} # Remove platform_ from dir name
SOURCEPATH=${SOURCEPATH//_//} # replace _ with / to make a path to directory to patch
if [ $SOURCEPATH == "build" ]; then SOURCEPATH="build/make"; fi # Replace build with build/make
if [ $SOURCEPATH == "treble/app" ]; then SOURCEPATH="treble_app"; fi
patch $FOLDER $SOURCEPATH
done
cd $TOP
RESET=false
}
rm -rf vendor/hardware_overlay
git clone https://github.com/trebledroid/vendor_hardware_overlay vendor/hardware_overlay -b pie --depth 1
rm -rf vendor/vndk-tests
git clone https://github.com/phhusson/vendor_vndk-tests vendor/vndk-tests -b master --depth 1
rm -rf vendor/interfaces
git clone https://github.com/trebledroid/vendor_interfaces vendor/interfaces -b android-14.0 --depth 1
rm -rf vendor/lptools
git clone https://github.com/phhusson/vendor_lptools vendor/lptools -b master --depth 1
rm -rf packages/apps/QcRilAm
git clone https://github.com/AndyCGYan/android_packages_apps_QcRilAm packages/apps/QcRilAm -b master --depth 1
echo "Getting keys, if this sync fails you need to change the script to call a valid keys repo with your own signing keys."
rm -rf vendor/rising/keys
git clone https://github.com/ItsLynix/RisingKeys vendor/rising/keys -b master --depth 1
rm -rf treble_app
git clone https://github.com/TrebleDroid/treble_app treble_app -b master --depth=1
rm -rf prebuilts/vndk/v28
git clone https://android.googlesource.com/platform/prebuilts/vndk/v28 ./prebuilts/vndk/v28
cd prebuilts/vndk/v28
git reset --hard 204f1bad00aaf480ba33233f7b8c2ddaa03155dd
cd ../../..
apply "TrebleDroid"
cd vendor/lineage
git reset --hard FETCH_HEAD
cd ../../
apply "UniversalX"
cd vendor/lineage
git am --abort
git reset --hard 21d91cce4404e54fcf55184c50c33ae441d9cd58
cd ../../
apply "naz664"
# Build treble app after applying patch
wget https://download.oracle.com/java/17/archive/jdk-17.0.12_linux-x64_bin.tar.gz
tar -xvf jdk-17.0.12_linux-x64_bin.tar.gz
rm -rf jdk-17.0.12_linux-x64_bin.tar.gz
export JAVA_HOME=$(pwd)/jdk-17.0.12
cd treble_app
bash build.sh release
cp -v TrebleApp.apk ../vendor/hardware_overlay/TrebleApp/app.apk
cd ..
rm -rf jdk-17.0.12
unset JAVA_HOME