From: mauronofrio matarrese Date: Sun, 3 Mar 2019 02:27:28 +0000 (+0100) Subject: Update Installer X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6bf80be287dccab78ed43869591e1ce0399f8d95;p=GitHub%2Fmoto-9609%2Ftwrp_device_motorola_troika.git Update Installer --- diff --git a/installer/META-INF/CERT.RSA b/installer/META-INF/CERT.RSA index b47b463..8c3a62d 100644 Binary files a/installer/META-INF/CERT.RSA and b/installer/META-INF/CERT.RSA differ diff --git a/installer/META-INF/CERT.SF b/installer/META-INF/CERT.SF index 3f308c0..42d5d98 100644 --- a/installer/META-INF/CERT.SF +++ b/installer/META-INF/CERT.SF @@ -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= diff --git a/installer/META-INF/MANIFEST.MF b/installer/META-INF/MANIFEST.MF index 3578c91..3c01a06 100644 --- a/installer/META-INF/MANIFEST.MF +++ b/installer/META-INF/MANIFEST.MF @@ -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 index e242d83..0000000 --- a/installer/META-INF/com/android/otacert +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD -VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g -VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE -AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe -Fw0wODAyMjkwMTMzNDZaFw0zNTA3MTcwMTMzNDZaMIGUMQswCQYDVQQGEwJVUzET -MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G -A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p -ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZ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xqCzJOLSDE4QyS9BAH6EhY6UFcOaE0= ------END CERTIFICATE----- diff --git a/installer/META-INF/com/google/android/update-binary b/installer/META-INF/com/google/android/update-binary index 7dfe811..fe83652 100644 --- a/installer/META-INF/com/google/android/update-binary +++ b/installer/META-INF/com/google/android/update-binary @@ -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 index 0000000..11d5c96 --- /dev/null +++ b/installer/META-INF/com/google/android/updater-script @@ -0,0 +1 @@ +#MAGISK diff --git a/installer/magiskboot b/installer/magiskboot index c7fdf4d..0f5f231 100644 Binary files a/installer/magiskboot and b/installer/magiskboot differ