assert(getprop("ro.product.device") == "ido" || getprop("ro.build.product") == "ido" || abort("E3004: This package is for device: ido; this device is " + getprop("ro.product.device") + "."););
ui_print("Target: Xiaomi/ido/ido:5.1.1/LMY47V/V9.6.1.0.LAICNFD:user/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
ui_print("                                               ");
ui_print("***********************************************");
ui_print("  __   __                      _    _ _____    ");
ui_print("  \ \ / /                     | |  | |  __ \   ");
ui_print("   \ V / ___ _ __   ___  _ __ | |__| | |  | |  ");
ui_print("    > < / _ \ '_ \ / _ \| '_ \|  __  | |  | |  ");
ui_print("   / . \  __/ | | | (_) | | | | |  | | |__| |  ");
ui_print("  /_/ \_\___|_| |_|\___/|_| |_|_|  |_|_____/   ");
ui_print("                                               ");
ui_print("                www.xenonhd.com                ");
ui_print("                                               ");
ui_print("***********************************************");
ui_print("                                               ");
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);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup", "/system");
unmount("/system");
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
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);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore", "/system");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.200000, 10);
set_progress(1.000000);
