forked from JarlPenguin/releases
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sync.sh
executable file
·97 lines (87 loc) · 4.64 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
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
#!/bin/bash
echo "Sync started for ${manifest_url}/tree/${branch}"
if [ "${jenkins}" == "true" ]; then
telegram -M "Sync started for [${ROM} ${ROM_VERSION}](${manifest_url}/tree/${branch}): [See Progress](${BUILD_URL}console)"
else
telegram -M "Sync started for [${ROM} ${ROM_VERSION}](${manifest_url}/tree/${branch})"
fi
SYNC_START=$(date +"%s")
repo init -u "${manifest_url}" -b "${branch}" --depth 1
if [ "${official}" != "true" ]; then
rm -rf .repo/local_manifests
mkdir -p .repo/local_manifests
wget "${local_manifest_url}" -O .repo/local_manifests/manifest.xml
fi
cores=$(nproc --all)
if [ "${cores}" -gt "8" ]; then
cores=8
fi
repo sync --force-sync --fail-fast --no-tags --no-clone-bundle --optimized-fetch --prune "-j${cores}" -c -v
syncsuccessful="${?}"
SYNC_END=$(date +"%s")
SYNC_DIFF=$((SYNC_END - SYNC_START))
if [ "${syncsuccessful}" == "0" ]; then
echo "Sync completed successfully in $((SYNC_DIFF / 60)) minute(s) and $((SYNC_DIFF % 60)) seconds"
export rom_vendor_name=$(echo vendor/*/config/common.mk |cut -d / -f 2 )
sed -i "s+android.hardware.power-ndk_platform+android.hardware.power-V1-ndk_platform+g" hardware/qcom-caf/sm8150/audio/hal/Android.mk
telegram -N -M "Sync completed successfully in $((SYNC_DIFF / 60)) minute(s) and $((SYNC_DIFF % 60)) seconds"
cd device/nubia/TP1803
rm -rf BoardConfig.mk
wget https://raw.githubusercontent.com/LineageOS/android_device_nubia_TP1803/8ed059568ddb4888fdee13c1c24614aa84ca2ea9/BoardConfig.mk
mv lineage_TP1803.mk ${rom_vendor_name}_TP1803.mk
sed -i "s+lineage+$rom_vendor_name+g" ${rom_vendor_name}_TP1803.mk
sed -i "s+lineage+$rom_vendor_name+g" AndroidProducts.mk
echo "BUILD_BROKEN_ENFORCE_SYSPROP_OWNER := true" >> BoardConfig.mk
echo "BUILD_BROKEN_MISSING_REQUIRED_MODULES := true " >> BoardConfig.mk
echo "BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true" >> BoardConfig.mk
echo "BUILD_BROKEN_DUP_RULES := true" >> BoardConfig.mk
echo "TARGET_SCREEN_HEIGHT := 2160" >> ${rom_vendor_name}_TP1803.mk
echo "TARGET_SCREEN_WIDTH := 1080" >> ${rom_vendor_name}_TP1803.mk
echo "TARGET_BOOT_ANIMATION_RES := 1080" >> ${rom_vendor_name}_TP1803.mk
cd ..
cd ..
cd ..
rm -rf hardware/qcom-caf/sm8150/audio;rm -rf hardware/qcom-caf/sm8150/display
git clone https://github.com/aospExtended/platform_hardware_qcom_audio -b 12.x-caf-sm8150 hardware/qcom-caf/sm8150/audio
git clone https://github.com/aospExtended/platform_hardware_qcom_display -b 12.x-caf-sm8150 hardware/qcom-caf/sm8150/display
sed -i "s+android.hardware.power-ndk_platform+android.hardware.power-V1-ndk_platform+g" hardware/qcom-caf/sm8150/audio/hal/Android.mk
cp -R vendor/qcom/opensource/commonsys-intf vendor/qcom/opensource/commonsys
export RELAX_USES_LIBRARY_CHECK=true
rm device/tadiphone-fw/fw/abl.elf
cp $my_dir/abl.v2.elf device/tadiphone-fw/fw/abl.elf
FILE=vendor/$rom_vendor_name/config/common_full_phone.mk
[ -f $FILE ] && echo "$FILE exists, skipping." || sed -i "s+common_full_phone.mk+common.mk+g" device/nubia/TP1803/${rom_vendor_name}_TP1803.mk
# Rom specific patches
# EvoX (Evolution X) Patches
# If git is used intead of https, Make it https so the the patches will apply
if [ "$manifest_url" = "git://github.com/Evolution-X/manifest" ]; then
export manifest_url="https://github.com/Evolution-X/manifest"
fi
# Apply Patches
if [ "$manifest_url" = "https://github.com/Evolution-X/manifest" ]; then
cd device/nubia/TP1803
# Change sys partition size (Needs sys resize kit, will replace with gapps debloat later)
sed -i "s+3221225472+3640655872+g" BoardConfig.mk
sed -i "s+55588106240+115601780736+g" BoardConfig.mk
cd ~/releases/android
fi
# End of EvoX specific patches
# Start of pe patches
if [ "$manifest_url" = "https://github.com/PixelExperience/manifest" ]; then
cd device/nubia/TP1803
echo "SELINUX_IGNORE_NEVERALLOWS := true" >> BoardConfig.mk
cd sepolicy
mkdir private && cd private
touch init.te
echo "allow init property_type:file { append create getattr map open read relabelto rename setattr unlink write };" >> init.te
cd .. && cd vendor
cp $my_dir/genfs_contexts genfs_contexts
cd ~/releases/android
fi
source "${my_dir}/build.sh"
else
echo "Sync failed in $((SYNC_DIFF / 60)) minute(s) and $((SYNC_DIFF % 60)) seconds (Press F)"
telegram -N -M "Sync failed in $((SYNC_DIFF / 60)) minute(s) and $((SYNC_DIFF % 60)) seconds"
curl --data parse_mode=HTML --data chat_id=$TELEGRAM_CHAT --data sticker=CAADBQADGgEAAixuhBPbSa3YLUZ8DBYE --request POST https://api.telegram.org/bot$TELEGRAM_TOKEN/sendSticker
exit 1
fi