getprop("ro.product.device") == "union_8g" || abort("This package is for \"union_8g\" devices; this is a \"" + getprop("ro.product.device") + "\".");
ui_print("Start to upgrade partition");
ui_print("Target: UNION_8G/aosp_union_8g_dvb/union_8g:6.0/MRA58K/04.20.010.00.00:userdebug/test-keys");
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/platform/mstar_mci.0/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");
ui_print("Verifying the updated system image...");
if range_sha1("/dev/block/platform/mstar_mci.0/by-name/system", "8,0,136,137,152,153,640,7945,245391") == "573d21789820193d56760144415e58b924b16b74" then
if range_sha1("/dev/block/platform/mstar_mci.0/by-name/system", "10,136,137,152,153,640,1152,7433,7945,245391,245903") == "bd10cd4c507e05caef23af4b586f691e0d73e5bd" then
ui_print("Verified the updated system image.");
else
  abort("system partition has unexpected non-zero contents after OTA update");
endif;
else
  abort("system partition has unexpected contents after OTA update");
endif;
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/platform/mstar_mci.0/by-name/boot");
ui_print("Updating tv images...");
package_extract_file("tvdatabase.img", "/dev/block/platform/mstar_mci.0/by-name/tvdatabase");
package_extract_file("tvconfig.img", "/dev/block/platform/mstar_mci.0/by-name/tvconfig");
package_extract_file("tvcustomer.img", "/dev/block/platform/mstar_mci.0/by-name/tvcustomer");
package_extract_file("tvservice.img", "/dev/block/platform/mstar_mci.0/by-name/tvservice");
ui_print("Updating /RTPM image...");
package_extract_file("RT_PM.bin", "/dev/block/platform/mstar_mci.0/by-name/RTPM");
ui_print("Updating /dtb image...");
package_extract_file("dtb.bin", "/dev/block/platform/mstar_mci.0/by-name/dtb");
ui_print("Updating mboot image...");
package_extract_file("rom_emmc_boot.bin", "/dev/block/mmcblk0boot0");
package_extract_file("mboot.bin", "/dev/block/platform/mstar_mci.0/by-name/MBOOT");
ui_print("Updating /optee image...");
package_extract_file("tee.aes", "/dev/block/platform/mstar_mci.0/by-name/optee");
ui_print("Updating /armfw image...");
package_extract_file("bl31.aes", "/dev/block/platform/mstar_mci.0/by-name/armfw");
ui_print("Reloading the environment variable in misc partition...");
reload_panel();
reload_env();
show_progress(0.200000, 10);
show_progress(0.000000, 0);
