2 # LazyFlasher installer backend (for helper functions only)
9 # write the location of the console buffer to /tmp/console for other scripts to use
10 echo "$console" > /tmp/console
12 console=$(cat /tmp/console)
13 [ "$console" ] || console=/proc/$$/fd/1
18 echo "ui_print $1" > "$console"
20 echo "ui_print " > "$console"
31 print "Failed to patch boot image!"
36 [ "$zip" ] && rm /tmp/console
42 unzip -o "$1" -d "$2" || abort "Failed to extract zip to $2!"
45 print "#########################################"
46 print "# TWRP installer for OnePlus 6T #"
47 print "# by mauronofrio #"
48 print "#########################################"
50 # Unpack the installer
52 print "Unpacking the installer..."
56 toolname="/magiskboot"
58 targetfile="/boot.img"
59 target="$tmp$targetfile"
63 print "Running boot image patcher on slot A..."
64 dd if=/dev/block/bootdevice/by-name/boot_a "of=$target"
65 "$tool" --unpack boot.img
66 cp -f ramdisk-recovery.cpio ramdisk.cpio
67 "$tool" --repack boot.img
68 dd if=new-boot.img of=/dev/block/bootdevice/by-name/boot_a
74 print "Running boot image patcher on slot B..."
75 dd if=/dev/block/bootdevice/by-name/boot_b "of=$target"
76 "$tool" --unpack boot.img
77 cp -f ramdisk-recovery.cpio ramdisk.cpio
78 "$tool" --repack boot.img
79 dd if=new-boot.img of=/dev/block/bootdevice/by-name/boot_b
81 print "Boot image patching complete"
84 print "Done installing TWRP!"