Add ota.sh to (try to) OTA
This commit is contained in:
parent
545be46423
commit
506be53b02
6
base.mk
6
base.mk
@ -150,6 +150,7 @@ PRODUCT_PACKAGES += \
|
|||||||
resetprop
|
resetprop
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
device/phh/treble/phh-securize.sh:system/bin/phh-securize.sh \
|
device/phh/treble/phh-securize.sh:system/bin/phh-securize.sh \
|
||||||
|
device/phh/treble/files/ota.sh:system/bin/ota.sh \
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
device/phh/treble/remove-telephony.sh:system/bin/remove-telephony.sh \
|
device/phh/treble/remove-telephony.sh:system/bin/remove-telephony.sh \
|
||||||
@ -176,6 +177,7 @@ PRODUCT_COPY_FILES += \
|
|||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.biometrics.fingerprint@2.1-service.oppo.compat \
|
android.hardware.biometrics.fingerprint@2.1-service.oppo.compat \
|
||||||
|
|
||||||
|
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
vr_hwc
|
vr_hwc \
|
||||||
|
curl \
|
||||||
|
|
||||||
|
65
files/ota.sh
Normal file
65
files/ota.sh
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
latestVersion=$(curl -L --silent https://api.github.com/repos/phhusson/treble_experimentations/releases |grep -oE 'v2[0-9]*' |sort -V |sort -u |tail -n 1)
|
||||||
|
if [ -n "$1" ];then
|
||||||
|
echo "Forcing dl of version $1 instead of $latestVersion"
|
||||||
|
latestVersion="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
flavor=$(getprop ro.build.flavor)
|
||||||
|
fileName=""
|
||||||
|
|
||||||
|
fileName="system-quack"
|
||||||
|
if echo "$flavor" |grep -E '^treble_arm64';then
|
||||||
|
fileName="${fileName}-arm64"
|
||||||
|
elif echo "$flavor" | grep -E '^treble_arm_';then
|
||||||
|
fileName="${fileName}-arm"
|
||||||
|
elif echo "$flavor" | grep -E '^treble_a64_';then
|
||||||
|
fileName="${fileName}-arm32_binder64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$flavor" |grep -E '^treble_[^_]*_b';then
|
||||||
|
fileName="${fileName}-ab"
|
||||||
|
elif echo "$flavor" |grep -E '^treble_[^_]*_a';then
|
||||||
|
fileName="${fileName}-aonly"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$flavor" |grep -E '^treble_[^_]*_.g';then
|
||||||
|
fileName="${fileName}-gapps"
|
||||||
|
elif echo "$flavor" |grep -E '^treble_[^_]*_.o';then
|
||||||
|
fileName="${fileName}-go"
|
||||||
|
elif echo "$flavor" |grep -E '^treble_[^_]*_.f';then
|
||||||
|
fileName="${fileName}-floss"
|
||||||
|
elif echo "$flavor" |grep -E '^treble_[^_]*_.v';then
|
||||||
|
fileName="${fileName}-floss"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fileName="${fileName}.img.xz"
|
||||||
|
url=https://github.com/phhusson/treble_experimentations/releases/download/"$latestVersion"/"${fileName}"
|
||||||
|
echo "Downloading from ${url}..."
|
||||||
|
#This path is really NOT ideal.
|
||||||
|
out=/sdcard/sys.img.xz
|
||||||
|
curl -L "$url" > $out
|
||||||
|
|
||||||
|
if [ "$(getprop ro.boot.dynamic_partitions)" = true ];then
|
||||||
|
#Having to decompress twice is pretty stupid, but how do I get the size otherwise?
|
||||||
|
size=$(busybox_phh xz -d -c < $out | simg2img_simple |wc -c)
|
||||||
|
lptools remove system_phh
|
||||||
|
lptools create system_phh "$size"
|
||||||
|
lptools unmap system_phh
|
||||||
|
dmDevice=$(lptools map system_phh|grep -oE '/dev/block/[^ ]*')
|
||||||
|
busybox_phh xz -d -c < $out | simg2img_simple > $dmDevice
|
||||||
|
lptools replace system_phh system
|
||||||
|
reboot
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
#Use twrp.sh
|
||||||
|
mkdir -p /cache/phh
|
||||||
|
uncrypt /data/media/0/sys.img.xz /cache/phh/block.map
|
||||||
|
touch /cache/phh/flash
|
||||||
|
reboot
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user