ui_print("Target: eppendorf/c170i_incubator/c170i_incubator:8.0.0/1.0.0-ga/20221027:user/dev-keys");
show_progress(0.200000, 10);
(!less_than_int(1666880717, getprop("ro.build.date.utc"))) || abort("E3003: Can't install this package (Thu Oct 27 14:25:17 UTC 2022) over newer build (" + getprop("ro.build.date") + ").");
getprop("ro.product.device") == "c170i_incubator" || abort("E3004: This package is for \"c170i_incubator\" devices; this is a \"" + getprop("ro.product.device") + "\".");
check_eeprom_product_type("c170i_incubator");
write_eeprom_product_type("c170i_incubator");
verify_sdcard("1024", "70", "950", "70", "4000", "70", "/dev/block/mmcblk0");
verify_sdcard("950", "70", "1024", "70", "/dev/block/mmcblk1");
ifelse(mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/cert", "") == "/cert"  && mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/ota", "") == "/ota" ,
unmount("/ota");
unmount("/cert");
"",
unmount("/ota");
unmount("/cert");
restore_partition_table("fdisk_1GB.in", "1024", "fdisk_1GB.in", "950", "fdisk_4GB.in", "4000", "/dev/block/mmcblk0");
format("ext4", "EMMC", "/dev/block/mmcblk0p7", "0", "/ota");
format("ext4", "EMMC", "/dev/block/mmcblk0p5", "0", "/cert");
);
ifelse(greater_than_int(get_partition_size("/dev/block/mmcblk0p1"),"30000000"),
"",
execute_cert_backup_script("backup");
restore_partition_table("fdisk_1GB.in", "1024", "fdisk_1GB.in", "950", "fdisk_4GB.in", "4000", "/dev/block/mmcblk0");
format("ext4", "EMMC", "/dev/block/mmcblk0p7", "0", "/ota");
format("ext4", "EMMC", "/dev/block/mmcblk0p5", "0", "/cert");
execute_cert_backup_script("restore");
);
!is_mounted("/cache") && (mount("ext4", "EMMC", "/dev/block/mmcblk1p1", "/cache", "") == "/cache" ||  abort("E: /cache partiton not mountable -- full update required"));
!is_mounted("/data") && (mount("ext4", "EMMC", "/dev/block/mmcblk1p2", "/data", "") == "/data" ||  abort("E: /data partiton not mountable -- full update required"));
delete("/data/misc/logd/logcat.2", "/data/misc/logd/logcat.3",
       "/data/misc/logd/logcat.4");
delete_recursive("/data/dalvik-cache");
unmount("/data");
show_progress(0.700000, 70);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/mmcblk0p4", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat") ||
  abort("E1001: Failed to update system image.");
show_progress(0.100000, 20);
format("ext4", "EMMC", "/dev/block/mmcblk0p1", "0", "/boot");
mount("ext4", "EMMC", "/dev/block/mmcblk0p1", "/boot", "");
package_extract_dir("boot", "/boot");
package_extract_file("recovery/uramdisk-recovery.img", "/boot/uramdisk-recovery.img");
format("ext4", "EMMC", "/dev/block/mmcblk0p2", "0", "/recovery");
mount("ext4", "EMMC", "/dev/block/mmcblk0p2", "/recovery", "");
package_extract_dir("boot", "/recovery");
package_extract_file("recovery/uramdisk-recovery.img", "/recovery/uramdisk-recovery.img");
resetPartitionAllZero("/dev/block/mmcblk0p6");
update_bootloader();
unmount("/boot");
unmount("/cache");
unmount("/recovery");
set_progress(1.000000);
