show_progress(1.000000, 10);
block_image_update("system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat");
mount("ext4", "EMMC", "/dev/block/platform/mtk-msdc.0/by-name/custom", "/custom");
if (access("/custom/simlock.key") != "0") then
unmount("/custom");
format("ext4", "EMMC", "/dev/block/platform/mtk-msdc.0/by-name/custom", "0", "/custom");
mount("ext4", "EMMC", "/dev/block/platform/mtk-msdc.0/by-name/custom", "/custom");
endif;
delete_recursive("/custom/3rd-party");
package_extract_dir("custom", "/custom");
set_metadata_recursive("/custom", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:custom_file:s0");
assert(package_extract_file("boot.img", "/tmp/boot.img"),
       write_raw_image("/tmp/boot.img", "bootimg"),
       delete("/tmp/boot.img"));
delete("/data/nvram/APCFG/APRDCL/MD_Type");
assert(package_extract_file("logo.img", "/tmp/logo.img"),
       write_raw_image("/tmp/logo.img", "logo"),
       delete("/tmp/logo.img"));
assert(package_extract_file("uboot.img", "/tmp/uboot.img"),
       write_raw_image("/tmp/uboot.img", "uboot"),
       delete("/tmp/uboot.img"));
assert(package_extract_file("mobicore.bin", "/tmp/tee1.img"),
       write_raw_image("/tmp/tee1.img", "tee1"),
       delete("/tmp/tee1.img"));
set_progress(1.000000);
unmount("/custom");
apply_sig(package_extract_file("sig/boot.sig"), "bootimg");
