assert(getprop("ro.product.device") == "OnePlus3" || getprop("ro.build.product") == "OnePlus3" || 
       getprop("ro.product.device") == "oneplus3" || getprop("ro.build.product") == "oneplus3" || 
       getprop("ro.product.device") == "OnePlus3T" || getprop("ro.build.product") == "OnePlus3T" || 
       getprop("ro.product.device") == "oneplus3t" || getprop("ro.build.product") == "oneplus3t" || abort("E3004: This package is for device: OnePlus3,oneplus3,OnePlus3T,oneplus3t; this device is " + getprop("ro.product.device") + "."););
assert(op3.verify_modem("2019-05-11 00:00:51") == "1" || abort("Modem firmware from OxygenOS 9.0.2 or newer stock ROMs is prerequisite to be compatible with this build."););
ui_print("Target: OnePlus/OnePlus3/OnePlus3:9/PKQ1.181203.001/1907311932:user/release-keys");
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
run_program("/tmp/install/bin/backuptool.sh", "backup", "/dev/block/bootdevice/by-name/system", "ext4");
ui_print("Patching system image unconditionally...");
show_progress(0.900000, 0);
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat") ||
  abort("E1001: Failed to update system image.");
show_progress(0.020000, 10);
run_program("/tmp/install/bin/backuptool.sh", "restore", "/dev/block/bootdevice/by-name/system", "ext4");
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.100000, 10);
set_progress(1.000000);
