From bc77ca416cb8d9475ae7e5fa88c316489fcb2f28 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Mon, 1 Nov 2021 20:44:23 -0400
Subject: [PATCH] Verity fixups

Not sure how I missed all of these?

Signed-off-by: Tad <tad@spotco.us>
---
 Misc/bringup                    | 25 +++++++++++++++++++++++++
 Scripts/LineageOS-15.1/Patch.sh | 25 +++++++++++++++++++++----
 Scripts/LineageOS-17.1/Patch.sh | 10 ++++++++++
 Scripts/LineageOS-18.1/Patch.sh | 28 ++++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 4 deletions(-)
 create mode 100644 Misc/bringup

diff --git a/Misc/bringup b/Misc/bringup
new file mode 100644
index 00000000..3a16ff86
--- /dev/null
+++ b/Misc/bringup
@@ -0,0 +1,25 @@
+Devices not on recent versions with newer unofficial builds available:
+
+himaul, currently 14.1:
+https://forum.xda-developers.com/t/rom-11-0-0-himaul-himawl-lineageos-18-1-unofficial.4199175/
+https://forum.xda-developers.com/t/rom-10-0-0-himaul-himawl-lineageos-17-1-unofficial.3994825/
+
+m7, currently 14.1:
+broken - https://forum.xda-developers.com/t/rom-11-0-unofficial-m7-all-lineageos-18-1-stable.4187799/
+https://forum.xda-developers.com/t/rom-10-0-unofficial-m7-all-lineageos-17-1-stable.3969563/
+
+hammerhead, currently 15.1/16.0
+broken - https://forum.xda-developers.com/t/rom-unofficial-lineageos-18-1-for-nexus-5-hammerhead-discontinued.4214367/
+https://forum.xda-developers.com/t/rom-unofficial-lineageos-17-1-for-nexus-5-hammerhead-discontinued.4039273/
+
+bullhead, currently 15.1
+missing source code - https://forum.xda-developers.com/t/rom-11-unofficial-lineageos-18-1-2021-08-09-discontinued.4318251/
+https://forum.xda-developers.com/t/rom-unofficial-lineageos-17-1-blod-patched-2021-08-09.4049993/
+https://forum.xda-developers.com/t/rom-kernel-unofficial-optimized-lineageos-17-1.4163495/
+
+angler, currently 15.1
+broken - https://forum.xda-developers.com/t/rom-unofficial-lineageos-18-1-for-nexus-6p-angler.4206397/
+https://forum.xda-developers.com/t/rom-unofficial-lineageos-17-1-for-nexus-6p-angler.4012099/
+
+dragon, currently 15.1
+broken - https://forum.xda-developers.com/t/rom-unofficial-lineageos-18-1-dragon-2021-10-06.3591152/
diff --git a/Scripts/LineageOS-15.1/Patch.sh b/Scripts/LineageOS-15.1/Patch.sh
index 3a358d98..a05b1521 100644
--- a/Scripts/LineageOS-15.1/Patch.sh
+++ b/Scripts/LineageOS-15.1/Patch.sh
@@ -285,18 +285,35 @@ if enterAndClear "device/asus/msm8916-common"; then
 rm -rf Android.bp sensors; #exact duplicate in asus/flo #XXX be careful with this
 fi;
 
+if enterAndClear "device/google/dragon"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
+if enterAndClear "device/huawei/angler"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
+if enterAndClear "device/htc/flounder"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
+if enterAndClear "device/lge/bullhead"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
 if enterAndClear "device/lge/msm8996-common"; then
 sed -i '3itypeattribute hwaddrs misc_block_device_exception;' sepolicy/hwaddrs.te;
 fi;
 
+if enterAndClear "device/moto/shamu"; then
+#git revert --no-edit 05fb49518049440f90423341ff25d4f75f10bc0c; #restore releasetools #TODO
+enableVerity; #Resurrect dm-verity
+fi;
+
 if enterAndClear "device/oneplus/oneplus2"; then
 sed -i 's|etc/permissions/qti_libpermissions.xml|vendor/etc/permissions/qti_libpermissions.xml|' proprietary-files.txt; #Fix outdated path
 fi;
 
-#if enterAndClear "device/moto/shamu"; then
-#git revert --no-edit 05fb49518049440f90423341ff25d4f75f10bc0c; #restore releasetools #TODO
-#fi;
-
 #Make changes to all devices
 cd "$DOS_BUILD_BASE";
 if [ "$DOS_LOWRAM_ENABLED" = true ]; then find "device" -maxdepth 2 -mindepth 2 -type d -print0 | xargs -0 -n 1 -P 8 -I {} bash -c 'enableLowRam "{}"'; fi;
diff --git a/Scripts/LineageOS-17.1/Patch.sh b/Scripts/LineageOS-17.1/Patch.sh
index 5c02c483..46d9e4cd 100644
--- a/Scripts/LineageOS-17.1/Patch.sh
+++ b/Scripts/LineageOS-17.1/Patch.sh
@@ -294,6 +294,10 @@ fi;
 #
 #START OF DEVICE CHANGES
 #
+if enterAndClear "device/yandex/Amber"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
 if enterAndClear "device/cyanogen/msm8916-common"; then
 awk -i inplace '!/TARGET_RELEASETOOLS_EXTENSIONS/' BoardConfigCommon.mk; #broken releasetools
 fi;
@@ -305,6 +309,7 @@ fi;
 
 if enterAndClear "device/google/marlin"; then
 git revert --no-edit 777dafa35f185b1f501e3c80b8ab495191583444; #remove some carrier blobs
+enableVerity; #Resurrect dm-verity
 sed -i 's/BTLogSave \\/BTLogSave/' common/base.mk; #deblobber fixup
 fi;
 
@@ -333,6 +338,10 @@ if enterAndClear "device/oneplus/avicii"; then
 enableVerity; #Resurrect dm-verity
 fi;
 
+if enterAndClear "device/oneplus/guacamoleb"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
 if enterAndClear "device/oneplus/oneplus2"; then
 sed -i 's|etc/permissions/qti_libpermissions.xml|vendor/etc/permissions/qti_libpermissions.xml|' proprietary-files.txt;
 echo "allow mm-qcamerad camera_data_file:file create_file_perms;" >> sepolicy/mm-qcamerad.te; #Likely some of these could be removed
@@ -353,6 +362,7 @@ awk -i inplace '!/TARGET_RELEASETOOLS_EXTENSIONS/' BoardConfigCommon.mk; #disabl
 fi;
 
 if enterAndClear "device/zuk/msm8996-common"; then
+enableVerity; #Resurrect dm-verity
 awk -i inplace '!/WfdCommon/' msm8996.mk; #fix breakage
 fi;
 
diff --git a/Scripts/LineageOS-18.1/Patch.sh b/Scripts/LineageOS-18.1/Patch.sh
index 90a64c88..005a63ab 100644
--- a/Scripts/LineageOS-18.1/Patch.sh
+++ b/Scripts/LineageOS-18.1/Patch.sh
@@ -300,6 +300,7 @@ fi;
 
 if enterAndClear "device/essential/mata"; then
 git revert --no-edit 1f1d061c4d7ddedcac503608e8fa333aff30a693 3928b30a97fe7f6b6020bbd9d83a56a32de4ba16 e91f0fece65d32ca407be532e2c4456056b1a968; #Unbreak the earpiece speaker, breaking the loud speaker volume control on calls
+enableVerity; #Resurrect dm-verity
 fi;
 
 if enterAndClear "device/fairphone/FP3"; then
@@ -394,12 +395,30 @@ fi;
 if enterAndClear "device/moto/shamu"; then
 git revert --no-edit 0ba2cb240e8483fa85fcc831328f70f65eeb7180 2be3c88c331387f03978b75ebc118e09738216d0 ff98fee8fc40d00e1c8b296fd4bb20077bc056d6; #breakage
 #git revert --no-edit 05fb49518049440f90423341ff25d4f75f10bc0c; #restore releasetools #TODO
+enableVerity; #Resurrect dm-verity
+fi;
+
+if enterAndClear "device/oneplus/guacamole"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
+if enterAndClear "device/oneplus/hotdog"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
+if enterAndClear "device/oneplus/hotdogb"; then
+enableVerity; #Resurrect dm-verity
 fi;
 
 if enterAndClear "device/oneplus/msm8998-common"; then
+enableVerity; #Resurrect dm-verity
 awk -i inplace '!/TARGET_RELEASETOOLS_EXTENSIONS/' BoardConfigCommon.mk; #disable releasetools to fix delta ota generation
 fi;
 
+if enterAndClear "device/oneplus/oneplus3"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
 if enterAndClear "device/oneplus/sdm845-common"; then
 enableVerity; #Resurrect dm-verity
 fi;
@@ -421,6 +440,10 @@ if enterAndClear "device/razer/aura"; then
 enableVerity; #Resurrect dm-verity
 fi;
 
+if enterAndClear "device/razer/cheryl"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
 if enterAndClear "device/samsung/jfltexx"; then
 smallerSystem;
 fi;
@@ -430,6 +453,10 @@ echo "TARGET_RECOVERY_DENSITY := hdpi" >> BoardConfigCommon.mk;
 echo "allow hal_gnss_default ssr_device:chr_file { open read };" >> sepolicy/common/hal_gnss_default.te;
 fi;
 
+if enterAndClear "device/xiaomi/beryllium"; then
+enableVerity; #Resurrect dm-verity
+fi;
+
 if enterAndClear "device/xiaomi/sdm845-common"; then
 enableVerity; #Resurrect dm-verity
 fi;
@@ -443,6 +470,7 @@ enableVerity; #Resurrect dm-verity
 fi;
 
 if enterAndClear "device/zuk/msm8996-common"; then
+enableVerity; #Resurrect dm-verity
 awk -i inplace '!/WfdCommon/' msm8996.mk; #fix breakage
 fi;