show_progress(0.500000, 0);
ui_print("Formatting system...");
unmount("/system");
format("ext4", "EMMC", "/dev/block/mmcblk0p14", "0");
ui_print("Installing system files...");
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
package_extract_dir("system", "/system");
ui_print("Creating system links...");
symlink("/system/etc/wifi/WCN1314_qcom_cfg.ini", "/system/etc/firmware/wlan/volans/WCN1314_qcom_cfg.ini");
symlink("/system/etc/wifi/WCN1314_qcom_wlan_nv.bin", "/system/etc/firmware/wlan/volans/WCN1314_qcom_wlan_nv.bin");
symlink("/system/lib/modules/volans/WCN1314_rf.ko", "/system/lib/modules/wlan.ko");
symlink("blue_errreport", "/system/bin/blue_error_report");
symlink("busybox", "/system/bin/[", "/system/bin/[[", "/system/bin/ash",
"/system/bin/awk", "/system/bin/base64", "/system/bin/basename",
"/system/bin/blkid", "/system/bin/bunzip2", "/system/bin/bzip2",
"/system/bin/cal", "/system/bin/chat", "/system/bin/chattr",
"/system/bin/chgrp", "/system/bin/chroot", "/system/bin/chrt",
"/system/bin/cksum", "/system/bin/clear", "/system/bin/comm",
"/system/bin/cp", "/system/bin/crond", "/system/bin/crontab",
"/system/bin/cut", "/system/bin/depmod", "/system/bin/devmem",
"/system/bin/diff", "/system/bin/dirname", "/system/bin/dnsd",
"/system/bin/dnsdomainname", "/system/bin/dos2unix", "/system/bin/du",
"/system/bin/echo", "/system/bin/egrep", "/system/bin/env",
"/system/bin/ether-wake", "/system/bin/expand", "/system/bin/expr",
"/system/bin/fakeidentd", "/system/bin/fdflush", "/system/bin/fdformat",
"/system/bin/fdisk", "/system/bin/fgrep", "/system/bin/find",
"/system/bin/fold", "/system/bin/free", "/system/bin/freeramdisk",
"/system/bin/fsck", "/system/bin/fsync", "/system/bin/ftpd",
"/system/bin/ftpget", "/system/bin/ftpput", "/system/bin/getopt",
"/system/bin/grep", "/system/bin/groups", "/system/bin/gunzip",
"/system/bin/head", "/system/bin/hexdump", "/system/bin/hostid",
"/system/bin/hostname", "/system/bin/httpd", "/system/bin/hwclock",
"/system/bin/ifenslave", "/system/bin/inetd", "/system/bin/inotifyd",
"/system/bin/install", "/system/bin/iostat", "/system/bin/ipaddr",
"/system/bin/ipcalc", "/system/bin/iplink", "/system/bin/iproute",
"/system/bin/iprule", "/system/bin/iptunnel", "/system/bin/killall",
"/system/bin/killall5", "/system/bin/less", "/system/bin/logname",
"/system/bin/losetup", "/system/bin/lsattr", "/system/bin/lsusb",
"/system/bin/lzop", "/system/bin/lzopcat", "/system/bin/md5sum",
"/system/bin/microcom", "/system/bin/mkdosfs", "/system/bin/mke2fs",
"/system/bin/mkfifo", "/system/bin/mkfs.ext2", "/system/bin/mkfs.vfat",
"/system/bin/mknod", "/system/bin/mkswap", "/system/bin/modinfo",
"/system/bin/modprobe", "/system/bin/more", "/system/bin/mt",
"/system/bin/nameif", "/system/bin/nanddump", "/system/bin/nandwrite",
"/system/bin/nc", "/system/bin/nice", "/system/bin/nmeter",
"/system/bin/nslookup", "/system/bin/ntpd", "/system/bin/od",
"/system/bin/patch", "/system/bin/pgrep", "/system/bin/pidof",
"/system/bin/ping6", "/system/bin/pkill", "/system/bin/pmap",
"/system/bin/powertop", "/system/bin/printf", "/system/bin/pscan",
"/system/bin/pwd", "/system/bin/rdate", "/system/bin/rdev",
"/system/bin/readahead", "/system/bin/realpath", "/system/bin/reset",
"/system/bin/rev", "/system/bin/rfkill", "/system/bin/run-parts",
"/system/bin/script", "/system/bin/scriptreplay", "/system/bin/sed",
"/system/bin/seq", "/system/bin/setkeycodes", "/system/bin/setlogcons",
"/system/bin/setsid", "/system/bin/sha1sum", "/system/bin/sha256sum",
"/system/bin/sha512sum", "/system/bin/showkey", "/system/bin/smemcap",
"/system/bin/sort", "/system/bin/split", "/system/bin/stat",
"/system/bin/strings", "/system/bin/stty", "/system/bin/sum",
"/system/bin/swapoff", "/system/bin/swapon", "/system/bin/sysctl",
"/system/bin/tac", "/system/bin/tail", "/system/bin/tar",
"/system/bin/tee", "/system/bin/telnet", "/system/bin/telnetd",
"/system/bin/test", "/system/bin/tftp", "/system/bin/tftpd",
"/system/bin/time", "/system/bin/timeout", "/system/bin/touch",
"/system/bin/tr", "/system/bin/traceroute", "/system/bin/traceroute6",
"/system/bin/tty", "/system/bin/ttysize", "/system/bin/tunctl",
"/system/bin/uname", "/system/bin/uncompress", "/system/bin/unexpand",
"/system/bin/uniq", "/system/bin/unix2dos", "/system/bin/unlzop",
"/system/bin/unzip", "/system/bin/usleep", "/system/bin/uudecode",
"/system/bin/uuencode", "/system/bin/vconfig", "/system/bin/vi",
"/system/bin/watch", "/system/bin/wc", "/system/bin/wget",
"/system/bin/which", "/system/bin/who", "/system/bin/whoami",
"/system/bin/whois", "/system/bin/xargs", "/system/bin/zcat",
"/system/xbin/base64", "/system/xbin/groups", "/system/xbin/inotifyd",
"/system/xbin/iostat", "/system/xbin/lsof", "/system/xbin/nanddump",
"/system/xbin/nandwrite", "/system/xbin/pmap", "/system/xbin/powertop",
"/system/xbin/rfkill", "/system/xbin/uncompress",
"/system/xbin/whois");
symlink("libloc_eng_v01.default.so", "/system/lib/hw/gps.default.so");
symlink("libloc_ext_v01.so", "/system/lib/libloc_ext.so");
symlink("libwiperjni_v01.so", "/system/lib/libwiperjni.so");
symlink("toolbox", "/system/bin/cat", "/system/bin/chmod",
"/system/bin/chown", "/system/bin/cmp", "/system/bin/date",
"/system/bin/dd", "/system/bin/df", "/system/bin/dmesg",
"/system/bin/getevent", "/system/bin/getprop", "/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/log",
"/system/bin/ls", "/system/bin/lsmod", "/system/bin/lsof",
"/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/reboot", "/system/bin/renice",
"/system/bin/rm", "/system/bin/rmdir", "/system/bin/rmmod",
"/system/bin/route", "/system/bin/schedtop", "/system/bin/sendevent",
"/system/bin/setconsole", "/system/bin/setprop", "/system/bin/sleep",
"/system/bin/smd", "/system/bin/start", "/system/bin/stop",
"/system/bin/sync", "/system/bin/top", "/system/bin/umount",
"/system/bin/uptime", "/system/bin/vmstat", "/system/bin/watchprops",
"/system/bin/wipe");
symlink("wiperiface_v01.so", "/system/bin/wiperiface");
ui_print("Set permission...");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm(0, 0, 0666, "/system/app/Superuser.apk");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 0, 0755, "/system/bin/busybox");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm(0, 0, 06755, "/system/bin/su");
set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
set_perm(0, 0, 0755, "/system/etc/bluetooth");
set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");
set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh");
set_perm(1000, 1000, 0777, "/system/etc/init.qcom.ftm_module.sh");
set_perm(1000, 1000, 0777, "/system/etc/init.qcom.ftm_module_out.sh");
set_perm(1000, 1000, 0755, "/system/etc/init.qcom.sdio.sh");
set_perm(0, 0, 0544, "/system/etc/install-recovery.sh");
set_perm(0, 0, 0666, "/system/etc/install-recovery.sh.ori");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm(0, 0, 0755, "/system/lib/cf3d_uninstall.sh");
set_perm(1000, 1000, 0644, "/system/lib/egl/libEGL_ORG_CF3D.so");
set_perm(1000, 1000, 0644, "/system/lib/libGLESv1_CM.so");
set_perm(1000, 1000, 0644, "/system/lib/libGLESv1_CM_ORG_CF3D.so");
set_perm(1000, 1000, 0644, "/system/lib/libGLESv2.so");
set_perm(1000, 1000, 0644, "/system/lib/libGLESv2_ORG_CF3D.so");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 2000, 0755, "/system/xbin");
set_perm(0, 2000, 0755, "/system/xbin/SecureTime_Test");
set_perm(0, 2000, 0755, "/system/xbin/dexdump");
set_perm(0, 2000, 0755, "/system/xbin/rtcreset");
ui_print("Update Boot image...");
show_progress(0.200000, 0);
show_progress(0.200000, 10);
package_extract_file("boot.img", "/dev/block/mmcblk0p9");
show_progress(0.100000, 0);
unmount("/system");