Update Installer
authormauronofrio matarrese <poronofrio@gmail.com>
Sun, 3 Mar 2019 02:27:28 +0000 (03:27 +0100)
committermauronofrio matarrese <poronofrio@gmail.com>
Sun, 3 Mar 2019 02:27:28 +0000 (03:27 +0100)
installer/META-INF/CERT.RSA
installer/META-INF/CERT.SF
installer/META-INF/MANIFEST.MF
installer/META-INF/com/android/otacert [deleted file]
installer/META-INF/com/google/android/update-binary
installer/META-INF/com/google/android/updater-script [new file with mode: 0644]
installer/magiskboot

index b47b4638b48b83f0c42ac2ed5166b1e308f8c06c..8c3a62d9c41a8df92247ef6d435189a4e1c9e95f 100644 (file)
Binary files a/installer/META-INF/CERT.RSA and b/installer/META-INF/CERT.RSA differ
index 3f308c022df4a07fb3ac6dcd3d9005d92bc8db5e..42d5d98f1f29a23a78442bfd4fc6127703afda37 100644 (file)
@@ -1,16 +1,16 @@
 Signature-Version: 1.0
-SHA1-Digest-Manifest: QCWCUCcRamzGoOTiTXSQ/1AKdMo=
+SHA1-Digest-Manifest: i7FHYIpuyxsM6HD3efSwslaJZXc=
 Created-By: 1.0 (Android SignApk)
 
-Name: ramdisk-twrp.cpio
-SHA1-Digest: GrJjW1FsLNiJC5RX2CIqEmX8eI4=
+Name: META-INF/com/google/android/updater-script
+SHA1-Digest-Manifest: pVUJ9D5th6d2sD8aeNp5zhiBUcs=
 
-Name: META-INF/com/android/otacert
-SHA1-Digest: QW7yPFUPbhU0tUYKW4i2EdneCnw=
+Name: ramdisk-twrp.cpio
+SHA1-Digest-Manifest: QxC9ruvvkW9+V3vsNYql1IeieCo=
 
 Name: META-INF/com/google/android/update-binary
-SHA1-Digest: 02Ul88djHsIFRsI5gdyIcSLa0XQ=
+SHA1-Digest-Manifest: zkbZ60ZI+Dta6BdGxxHnCmAX7qY=
 
 Name: magiskboot
-SHA1-Digest: 0fk+6jdh3EAyaBFFHavgeVhRFDc=
+SHA1-Digest-Manifest: 73OeOdGxnv1r0iM1NaJW+Y1NP1U=
 
index 3578c910fe8b76d49fabadbbdab6c2ebcf798dcc..3c01a0627541568105d025673153689610a978c7 100644 (file)
@@ -1,15 +1,15 @@
 Manifest-Version: 1.0
 Created-By: 1.0 (Android SignApk)
 
-Name: ramdisk-twrp.cpio
-SHA1-Digest: gtuG6Rf4Ywfx+3hraZUQZQ27Ukw=
+Name: META-INF/com/google/android/updater-script
+SHA1-Digest: Lzl1y1cC6TvXytLj6okU81/P8AA=
 
-Name: META-INF/com/android/otacert
-SHA1-Digest: 71Q6Rn2DDZl1zPDVaaeEHItd+Yg=
+Name: ramdisk-twrp.cpio
+SHA1-Digest: DGb/yAJO6TXiv1zWztNkwyxaFUs=
 
 Name: META-INF/com/google/android/update-binary
-SHA1-Digest: Om9VSieSZdIxXv08mMFDJuUHrBA=
+SHA1-Digest: hZ5S81htomhMGZS8euHbmuq97vI=
 
 Name: magiskboot
-SHA1-Digest: BT3tcdY5tZnJ8FVbujrBWEufjVw=
+SHA1-Digest: npI5rDS2Z1cFaQBGpqfb5LMyANo=
 
diff --git a/installer/META-INF/com/android/otacert b/installer/META-INF/com/android/otacert
deleted file mode 100644 (file)
index e242d83..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD
-VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g
-VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE
-AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe
-Fw0wODAyMjkwMTMzNDZaFw0zNTA3MTcwMTMzNDZaMIGUMQswCQYDVQQGEwJVUzET
-MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G
-A1UEChMHQW5kcm9pZDEQMA4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n9gP+pWA7LFQNvXwBnDa6sppCccEX
-31I828XzgXpJ4O+mDL1/dBd+ek8ZPUP0IgdyZm5MTYPhvVqGCHzzTy3sIeJFymwr
-sBbmg2OAUNLEMO6nwmocSdN2ClirfxqCzJOLSDE4QyS9BAH6EhY6UFcOaE0=
------END CERTIFICATE-----
index 7dfe811ac6effa20fecdee81ea6dd96c729d3557..fe8365291f430b0b52719262343a17bc12ca3b11 100644 (file)
@@ -1,39 +1,27 @@
 #!/sbin/sh
 # LazyFlasher installer backend (for helper functions only)
 
-tmp=/tmp/twrp-install
+tmp=/dev/tmp/twrp-install
+
+# detect when flashing in Magisk Manager
+ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false;
+$BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true;
 
 if [ "$3" ]; then
        zip=$3
        console=/proc/$$/fd/$2
-       # write the location of the console buffer to /tmp/console for other scripts to use
-       echo "$console" > /tmp/console
-else
-       console=$(cat /tmp/console)
-       [ "$console" ] || console=/proc/$$/fd/1
 fi
 
 print() {
-       if [ "$1" ]; then
-               echo "ui_print $1" > "$console"
+       if $BOOTMODE; then
+               echo "$1"
        else
-               echo "ui_print  " > "$console"
+               if [ "$1" ]; then
+                       echo "ui_print $1" > "$console"
+               else
+                       echo "ui_print  " > "$console"
+               fi
        fi
-       echo
-}
-
-abort() {
-       [ "$1" ] && {
-               print "Error: $1"
-               print "Aborting..."
-       }
-       cleanup
-       print "Failed to patch boot image!"
-       exit 1
-}
-
-cleanup() {
-       [ "$zip" ] && rm /tmp/console
 }
 
 extract() {
@@ -42,15 +30,17 @@ extract() {
        unzip -o "$1" -d "$2" || abort "Failed to extract zip to $2!"
 }
 
-print "#########################################"
-print "#     TWRP installer for OnePlus 6T     #"
-print "#             by mauronofrio            #"
-print "#########################################"
+print "########################################"
+print "#     TWRP installer for OnePlus6T     #"
+print "#            by mauronofrio            #"
+print "########################################"
+print
 
 # Unpack the installer
 [ "$zip" ] && {
        print "Unpacking the installer..."
        extract "$zip" "$tmp"
+       print
 }
 cd "$tmp"
 toolname="/magiskboot"
@@ -60,25 +50,31 @@ target="$tmp$targetfile"
 
 chmod 755 "$tool"
 
-print "Running boot image patcher on slot A..."
-dd if=/dev/block/bootdevice/by-name/boot_a "of=$target"
-"$tool" --unpack boot.img
-cp -f ramdisk-recovery.cpio ramdisk.cpio
-"$tool" --repack boot.img
-dd if=new-boot.img of=/dev/block/bootdevice/by-name/boot_a
-rm boot.img
-rm dtb
-rm kernel
-rm new-boot.img
-rm ramdisk.cpio
-print "Running boot image patcher on slot B..."
-dd if=/dev/block/bootdevice/by-name/boot_b "of=$target"
-"$tool" --unpack boot.img
-cp -f ramdisk-recovery.cpio ramdisk.cpio
-"$tool" --repack boot.img
-dd if=new-boot.img of=/dev/block/bootdevice/by-name/boot_b
+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
+       # kernel string want_initramfs -> skip_initramfs (Magisk)
+       "$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
+       dd if=new-boot.img of=/dev/block/bootdevice/by-name/boot_$slot
+
+       "$tool" --cleanup
+       rm -f new-boot.img
+done
+
+print
+print "Boot image patching complete!"
 
-print "Boot image patching complete"
+cd /
+rm -rf /dev/tmp
 
-#cleanup
+print
 print "Done installing TWRP!"
+print
+print "*** NOTE: You are now unrooted! ***"
diff --git a/installer/META-INF/com/google/android/updater-script b/installer/META-INF/com/google/android/updater-script
new file mode 100644 (file)
index 0000000..11d5c96
--- /dev/null
@@ -0,0 +1 @@
+#MAGISK
index c7fdf4d3c57ef724072c8ad55c8ac5ecbd020f74..0f5f2314a9a3aeaa3ad7d992a70ff257eff32c7d 100644 (file)
Binary files a/installer/magiskboot and b/installer/magiskboot differ