assert(getprop("ro.product.device") == "JmGO_G1S" ||
       getprop("ro.build.product") == "JmGO_G1S");
show_progress(0.950000, 60);
format("ext4", "EMMC", "/dev/block/platform/mstar_mci.0/by-name/system", "0", "/system");
mount("ext4", "EMMC", "/dev/block/platform/mstar_mci.0/by-name/system", "/system");
package_extract_dir("recovery", "/system");
package_extract_dir("system", "/system");
symlink("/data/system/resolv.conf", "/system/etc/resolv.conf");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/cat", "/system/bin/chcon",
        "/system/bin/chmod", "/system/bin/chown", "/system/bin/clear",
        "/system/bin/cmp", "/system/bin/cp", "/system/bin/date",
        "/system/bin/dd", "/system/bin/df", "/system/bin/dmesg",
        "/system/bin/du", "/system/bin/getenforce", "/system/bin/getevent",
        "/system/bin/getprop", "/system/bin/getsebool", "/system/bin/grep",
        "/system/bin/hd", "/system/bin/id", "/system/bin/ifconfig",
        "/system/bin/iftop", "/system/bin/insmod", "/system/bin/ioctl",
        "/system/bin/ionice", "/system/bin/kill", "/system/bin/ln",
        "/system/bin/load_policy", "/system/bin/log", "/system/bin/ls",
        "/system/bin/lsmod", "/system/bin/lsof", "/system/bin/md5",
        "/system/bin/mkdir", "/system/bin/mount", "/system/bin/mv",
        "/system/bin/nandread", "/system/bin/netstat",
        "/system/bin/newfs_msdos", "/system/bin/notify", "/system/bin/printenv",
        "/system/bin/ps", "/system/bin/r", "/system/bin/reboot",
        "/system/bin/renice", "/system/bin/restorecon", "/system/bin/rm",
        "/system/bin/rmdir", "/system/bin/rmmod", "/system/bin/route",
        "/system/bin/runcon", "/system/bin/schedtop", "/system/bin/sendevent",
        "/system/bin/setconsole", "/system/bin/setenforce",
        "/system/bin/setprop", "/system/bin/setsebool", "/system/bin/sleep",
        "/system/bin/smd", "/system/bin/start", "/system/bin/stop",
        "/system/bin/sync", "/system/bin/top", "/system/bin/touch",
        "/system/bin/umount", "/system/bin/uptime", "/system/bin/vmstat",
        "/system/bin/watchprops",
        "/system/bin/wipe");
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("Need reload env after reboot");
reload_panel();
reload_env();
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 0, 0755, "/system/bin/ping");
set_perm(0, 2000, 0750, "/system/bin/run-as");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 1000, 06775, "/system/etc/dvfs_scaling.sh");
set_perm(0, 0, 0544, "/system/etc/install-recovery.sh");
set_perm(1000, 1000, 0640, "/system/etc/keep_xc_4k2k30hz_packages.xml");
set_perm(1000, 1000, 0640, "/system/etc/osd_switch_packages.xml");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm(0, 0, 0644, "/system/vendor/lib/libbt-vendor.so");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/xbin/librank");
set_perm(0, 0, 06755, "/system/xbin/procmem");
set_perm(0, 0, 06755, "/system/xbin/procrank");
set_perm(0, 0, 06755, "/system/xbin/su");
package_extract_file("boot.img", "/dev/block/platform/mstar_mci.0/by-name/boot");
ui_print("Updating Partition images...");
package_extract_file("tvconfig.img", "/dev/block/platform/mstar_mci.0/by-name/tvconfig");
ui_print("Updating TV images...");
package_extract_file("tvdatabase.img", "/dev/block/platform/mstar_mci.0/by-name/tvdatabase");
package_extract_file("tvservice.img", "/dev/block/platform/mstar_mci.0/by-name/tvservice");
package_extract_file("tvcustomer.img", "/dev/block/platform/mstar_mci.0/by-name/tvcustomer");
ui_print("Updating Partition images...");
package_extract_file("RT_PM.bin", "/dev/block/platform/mstar_mci.0/by-name/RTPM");
show_progress(0.050000, 2);
show_progress(0.000000, 0);
unmount("/system");
