+++ /dev/null
-Signature-Version: 1.0
-SHA1-Digest-Manifest: i7FHYIpuyxsM6HD3efSwslaJZXc=
-Created-By: 1.0 (Android SignApk)
-
-Name: META-INF/com/google/android/updater-script
-SHA1-Digest-Manifest: pVUJ9D5th6d2sD8aeNp5zhiBUcs=
-
-Name: ramdisk-twrp.cpio
-SHA1-Digest-Manifest: QxC9ruvvkW9+V3vsNYql1IeieCo=
-
-Name: META-INF/com/google/android/update-binary
-SHA1-Digest-Manifest: zkbZ60ZI+Dta6BdGxxHnCmAX7qY=
-
-Name: magiskboot
-SHA1-Digest-Manifest: 73OeOdGxnv1r0iM1NaJW+Y1NP1U=
-
+++ /dev/null
-Manifest-Version: 1.0
-Created-By: 1.0 (Android SignApk)
-
-Name: META-INF/com/google/android/updater-script
-SHA1-Digest: Lzl1y1cC6TvXytLj6okU81/P8AA=
-
-Name: ramdisk-twrp.cpio
-SHA1-Digest: DGb/yAJO6TXiv1zWztNkwyxaFUs=
-
-Name: META-INF/com/google/android/update-binary
-SHA1-Digest: hZ5S81htomhMGZS8euHbmuq97vI=
-
-Name: magiskboot
-SHA1-Digest: npI5rDS2Z1cFaQBGpqfb5LMyANo=
-
#!/sbin/sh
# LazyFlasher installer backend (for helper functions only)
+# Heavily modified by Dees_Troy and osm0sis
tmp=/dev/tmp/twrp-install
print "########################################"
print
-# Unpack the installer
+# unpack the installer
[ "$zip" ] && {
print "Unpacking the installer..."
extract "$zip" "$tmp"
tool="$tmp$toolname"
targetfile="/boot.img"
target="$tmp$targetfile"
+recoverycpio=`(ls ramdisk-twrp.cpio || ls ramdisk-recovery.cpio) 2>/dev/null`
chmod 755 "$tool"
for slot in a b; do
print "Running boot image patcher on slot $slot..."
dd if=/dev/block/bootdevice/by-name/boot_$slot "of=$target"
- "$tool" --unpack boot.img
+ "$tool" unpack -h boot.img
+
# kernel string want_initramfs -> skip_initramfs (Magisk)
- "$tool" --hexpatch kernel 77616E745F696E697472616D6673 736B69705F696E697472616D6673
+ "$tool" hexpatch kernel 77616E745F696E697472616D6673 736B69705F696E697472616D6673
# kernel string trip_initramfs -> skip_initramfs (SuperSU)
- "$tool" --hexpatch kernel 747269705F696E697472616D6673 736B69705F696E697472616D6673
- cp -f ramdisk-recovery.cpio ramdisk.cpio
- "$tool" --repack boot.img
- # boot.img cmdline skip_override -> ' ' (flar2 patch)
- "$tool" --hexpatch new-boot.img 736B69705F6F76657272696465 20202020202020202020202020
+ "$tool" hexpatch kernel 747269705F696E697472616D6673 736B69705F696E697472616D6673
+
+ # boot.img cmdline remove skip_override (flar2 patch)
+ sed -i "s|$(grep '^cmdline=' header | cut -d= -f2-)|$(grep '^cmdline=' header | cut -d= -f2- | sed -e 's/skip_override//' -e 's/ */ /g' -e 's/[ \t]*$//')|" header
+
+ cp -f $recoverycpio ramdisk.cpio
+ "$tool" repack boot.img
dd if=new-boot.img of=/dev/block/bootdevice/by-name/boot_$slot
- "$tool" --cleanup
+ "$tool" cleanup
rm -f new-boot.img
done