mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/userdata", "/data");
show_progress(0.500000, 0);
ui_print("Formatting system...");
unmount("/system");
ui_print("Installing system files...");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
delete_recursive("/system");
package_extract_dir("system", "/system");
package_extract_dir("tmp", "/tmp");
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "1"
then
ui_print("@ Install F320S Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/f320s/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
package_extract_dir("variant/f320s/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "2"
then
ui_print("@ Install F320K Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/f320k/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
package_extract_dir("variant/f320k/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "3"
then
ui_print("@ Install F320L Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/f320l/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
package_extract_dir("variant/f320l/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "4"
then
ui_print("@ Install D800 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/d800/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
package_extract_dir("variant/d800/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "5"
then
ui_print("@ Install D801 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/d801/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
package_extract_dir("variant/d801/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "6"
then
ui_print("@ Install D802 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/d802/boot.img", "/tmp/boot.img");
package_extract_dir("variant/d802/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "7"
then
ui_print("@ Install D803 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/d803/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
package_extract_dir("variant/d803/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "8"
then
ui_print("@ Install D805 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/d805/boot.img", "/tmp/boot.img");
package_extract_dir("variant/d805/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "9"
then
ui_print("@ Install D806 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/d806/boot.img", "/tmp/boot.img");
package_extract_dir("variant/d806/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "10"
then
ui_print("@ Install LS980 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/ls980/boot.img", "/tmp/boot.img");
delete("/system/app/LgNfc.apk");
delete("/system/priv-app/Tag.apk");
delete("/system/framework/org.simalliance.openmobileapi.jar");
delete("/system/lib/hw/nfc_lg.default.so");
delete("/system/etc/permissions/android.hardware.nfc.hce.xml");
package_extract_dir("variant/ls980/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "11"
then
ui_print("@ Install VS980 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/vs980/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
package_extract_dir("variant/vs980/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "12"
then
ui_print("@ Install L-01F Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/l01f/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
delete("/system/app/LgNfc.apk");
delete("/system/priv-app/Tag.apk");
delete("/system/framework/org.simalliance.openmobileapi.jar");
delete("/system/lib/hw/nfc_lg.default.so");
delete("/system/etc/permissions/android.hardware.nfc.hce.xml");
package_extract_dir("variant/l01f/system", "/system");
endif;
if
file_getprop("/tmp/aroma-data/mods.prop","selected.1") == "13"
then
ui_print("@ Install L22 Boot image...");
show_progress(0.100000, 3);
package_extract_file("variant/l22/boot.img", "/tmp/boot.img");
delete("/system/app/LGFmRadio.apk");
delete("/system/app/LgNfc.apk");
delete("/system/priv-app/Tag.apk");
delete("/system/framework/org.simalliance.openmobileapi.jar");
delete("/system/lib/hw/nfc_lg.default.so");
delete("/system/etc/permissions/android.hardware.nfc.hce.xml");
package_extract_dir("variant/l22/system", "/system");
endif;
ui_print("Creating system links...");
symlink("../ui/MessageComplete.ogg", "/system/media/audio/notifications/MessageComplete.ogg");
symlink("../ui/MessageIncoming.ogg", "/system/media/audio/notifications/MessageIncoming.ogg");
symlink("/data/misc/audio/mbhc.bin", "/system/etc/firmware/wcd9320/wcd9320_mbhc.bin");
symlink("/data/misc/audio/wcd9320_anc.bin", "/system/etc/firmware/wcd9320/wcd9320_anc.bin");
symlink("/data/misc/audio/wcd9320_mad_audio.bin", "/system/etc/firmware/wcd9320/wcd9320_mad_audio.bin");
symlink("/etc/thermal-engine-8974.conf", "/system/etc/thermal-engine.conf");
symlink("/etc/thermald-8974.conf", "/system/etc/thermald.conf");
symlink("/firmware/image/dxhdcp2.b00", "/system/etc/firmware/dxhdcp2.b00");
symlink("/firmware/image/dxhdcp2.b01", "/system/etc/firmware/dxhdcp2.b01");
symlink("/firmware/image/dxhdcp2.b02", "/system/etc/firmware/dxhdcp2.b02");
symlink("/firmware/image/dxhdcp2.b03", "/system/etc/firmware/dxhdcp2.b03");
symlink("/firmware/image/dxhdcp2.mdt", "/system/etc/firmware/dxhdcp2.mdt");
symlink("/firmware/image/mlserver.b00", "/system/etc/firmware/mlserverapp.b00");
symlink("/firmware/image/mlserver.b01", "/system/etc/firmware/mlserverapp.b01");
symlink("/firmware/image/mlserver.b02", "/system/etc/firmware/mlserverapp.b02");
symlink("/firmware/image/mlserver.b03", "/system/etc/firmware/mlserverapp.b03");
symlink("/firmware/image/mlserver.mdt", "/system/etc/firmware/mlserverapp.mdt");
symlink("/firmware/image/tqs.b00", "/system/etc/firmware/tqs.b00");
symlink("/firmware/image/tqs.b01", "/system/etc/firmware/tqs.b01");
symlink("/firmware/image/tqs.b02", "/system/etc/firmware/tqs.b02");
symlink("/firmware/image/tqs.b03", "/system/etc/firmware/tqs.b03");
symlink("/firmware/image/tqs.mdt", "/system/etc/firmware/tqs.mdt");
symlink("/persist-lg/firmware/widevine.b00", "/system/vendor/firmware/widevine.b00");
symlink("/persist-lg/firmware/widevine.b01", "/system/vendor/firmware/widevine.b01");
symlink("/persist-lg/firmware/widevine.b02", "/system/vendor/firmware/widevine.b02");
symlink("/persist-lg/firmware/widevine.b03", "/system/vendor/firmware/widevine.b03");
symlink("/persist-lg/firmware/widevine.mdt", "/system/vendor/firmware/widevine.mdt");
symlink("/system/bin/mksh", "/system/bin/sh");
symlink("/system/bin/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/mkswap", "/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/readlink", "/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/swapoff", "/system/bin/swapon", "/system/bin/sync",
"/system/bin/top", "/system/bin/touch", "/system/bin/umount",
"/system/bin/uptime", "/system/bin/vmstat", "/system/bin/watchprops",
"/system/bin/wipe");
symlink("/system/fonts/Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("/system/fonts/Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("/system/lib/libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("/system/lib/libuicc.so", "/system/lib/libusim_aka.so");
symlink("/system/xbin/busybox", "/system/xbin/[", "/system/xbin/[[",
"/system/xbin/acpid", "/system/xbin/adjtimex", "/system/xbin/arp",
"/system/xbin/arping", "/system/xbin/ash", "/system/xbin/awk",
"/system/xbin/base64", "/system/xbin/basename", "/system/xbin/beep",
"/system/xbin/blkid", "/system/xbin/blockdev", "/system/xbin/brctl",
"/system/xbin/bunzip2", "/system/xbin/bzcat", "/system/xbin/bzip2",
"/system/xbin/cal", "/system/xbin/cat", "/system/xbin/catv",
"/system/xbin/chat", "/system/xbin/chattr", "/system/xbin/chgrp",
"/system/xbin/chmod", "/system/xbin/chown", "/system/xbin/chpst",
"/system/xbin/chroot", "/system/xbin/chrt", "/system/xbin/chvt",
"/system/xbin/cksum", "/system/xbin/clear", "/system/xbin/cmp",
"/system/xbin/comm", "/system/xbin/conspy", "/system/xbin/cpio",
"/system/xbin/crond", "/system/xbin/crontab", "/system/xbin/cut",
"/system/xbin/date", "/system/xbin/dc", "/system/xbin/dd",
"/system/xbin/deallocvt", "/system/xbin/depmod", "/system/xbin/devmem",
"/system/xbin/df", "/system/xbin/diff", "/system/xbin/dirname",
"/system/xbin/dmesg", "/system/xbin/dnsd", "/system/xbin/dnsdomainname",
"/system/xbin/dos2unix", "/system/xbin/du", "/system/xbin/dumpkmap",
"/system/xbin/echo", "/system/xbin/ed", "/system/xbin/egrep",
"/system/xbin/env", "/system/xbin/envdir", "/system/xbin/envuidgid",
"/system/xbin/ether-wake", "/system/xbin/expand", "/system/xbin/expr",
"/system/xbin/fakeidentd", "/system/xbin/false", "/system/xbin/fbset",
"/system/xbin/fbsplash", "/system/xbin/fdflush",
"/system/xbin/fdformat", "/system/xbin/fdisk", "/system/xbin/fgconsole",
"/system/xbin/fgrep", "/system/xbin/find", "/system/xbin/findfs",
"/system/xbin/flock", "/system/xbin/fold", "/system/xbin/free",
"/system/xbin/freeramdisk", "/system/xbin/fsck",
"/system/xbin/fsck.minix", "/system/xbin/fstrim", "/system/xbin/fsync",
"/system/xbin/ftpd", "/system/xbin/ftpget", "/system/xbin/ftpput",
"/system/xbin/fuser", "/system/xbin/getopt", "/system/xbin/grep",
"/system/xbin/groups", "/system/xbin/gunzip", "/system/xbin/gzip",
"/system/xbin/hd", "/system/xbin/hdparm", "/system/xbin/head",
"/system/xbin/hexdump", "/system/xbin/hostname", "/system/xbin/httpd",
"/system/xbin/hush", "/system/xbin/hwclock", "/system/xbin/id",
"/system/xbin/ifconfig", "/system/xbin/ifdown", "/system/xbin/ifup",
"/system/xbin/inetd", "/system/xbin/insmod", "/system/xbin/install",
"/system/xbin/ionice", "/system/xbin/iostat", "/system/xbin/ip",
"/system/xbin/ipaddr", "/system/xbin/ipcalc", "/system/xbin/iproute",
"/system/xbin/iprule", "/system/xbin/iptunnel", "/system/xbin/kbd_mode",
"/system/xbin/kill", "/system/xbin/killall", "/system/xbin/killall5",
"/system/xbin/less", "/system/xbin/ln", "/system/xbin/loadkmap",
"/system/xbin/losetup", "/system/xbin/lpd", "/system/xbin/lpq",
"/system/xbin/lpr", "/system/xbin/ls", "/system/xbin/lsattr",
"/system/xbin/lsmod", "/system/xbin/lsof", "/system/xbin/lspci",
"/system/xbin/lsusb", "/system/xbin/lzcat", "/system/xbin/lzma",
"/system/xbin/lzop", "/system/xbin/lzopcat", "/system/xbin/makedevs",
"/system/xbin/man", "/system/xbin/md5sum", "/system/xbin/microcom",
"/system/xbin/mkdir", "/system/xbin/mkdosfs", "/system/xbin/mke2fs",
"/system/xbin/mkfifo", "/system/xbin/mkfs.ext2",
"/system/xbin/mkfs.minix", "/system/xbin/mkfs.vfat",
"/system/xbin/mknod", "/system/xbin/mkswap", "/system/xbin/modinfo",
"/system/xbin/modprobe", "/system/xbin/more", "/system/xbin/mount",
"/system/xbin/mountpoint", "/system/xbin/mpstat", "/system/xbin/mv",
"/system/xbin/nameif", "/system/xbin/nanddump",
"/system/xbin/nandwrite", "/system/xbin/nbd-client", "/system/xbin/nc",
"/system/xbin/netstat", "/system/xbin/nice", "/system/xbin/nmeter",
"/system/xbin/nohup", "/system/xbin/nslookup", "/system/xbin/ntpd",
"/system/xbin/od", "/system/xbin/openvt", "/system/xbin/patch",
"/system/xbin/pgrep", "/system/xbin/pidof", "/system/xbin/ping",
"/system/xbin/ping6", "/system/xbin/pipe_progress",
"/system/xbin/pivot_root", "/system/xbin/pkill", "/system/xbin/pmap",
"/system/xbin/powertop", "/system/xbin/printenv", "/system/xbin/printf",
"/system/xbin/ps", "/system/xbin/pscan", "/system/xbin/pstree",
"/system/xbin/pwd", "/system/xbin/pwdx", "/system/xbin/raidautorun",
"/system/xbin/rdate", "/system/xbin/rdev", "/system/xbin/readahead",
"/system/xbin/readlink", "/system/xbin/readprofile",
"/system/xbin/realpath", "/system/xbin/renice", "/system/xbin/reset",
"/system/xbin/resize", "/system/xbin/rev", "/system/xbin/rm",
"/system/xbin/rmdir", "/system/xbin/rmmod", "/system/xbin/route",
"/system/xbin/rpm", "/system/xbin/rpm2cpio", "/system/xbin/rtcwake",
"/system/xbin/run-parts", "/system/xbin/runsv", "/system/xbin/runsvdir",
"/system/xbin/rx", "/system/xbin/script", "/system/xbin/scriptreplay",
"/system/xbin/sed", "/system/xbin/seq", "/system/xbin/setconsole",
"/system/xbin/setkeycodes", "/system/xbin/setlogcons",
"/system/xbin/setserial", "/system/xbin/setsid",
"/system/xbin/setuidgid", "/system/xbin/sha1sum",
"/system/xbin/sha256sum", "/system/xbin/sha3sum",
"/system/xbin/sha512sum", "/system/xbin/showkey",
"/system/xbin/slattach", "/system/xbin/sleep", "/system/xbin/smemcap",
"/system/xbin/softlimit", "/system/xbin/sort", "/system/xbin/split",
"/system/xbin/start-stop-daemon", "/system/xbin/stat",
"/system/xbin/strings", "/system/xbin/stty", "/system/xbin/sum",
"/system/xbin/sv", "/system/xbin/svlogd", "/system/xbin/swapoff",
"/system/xbin/swapon", "/system/xbin/switch_root", "/system/xbin/sync",
"/system/xbin/sysctl", "/system/xbin/tac", "/system/xbin/tail",
"/system/xbin/tcpsvd", "/system/xbin/tee", "/system/xbin/telnet",
"/system/xbin/telnetd", "/system/xbin/test", "/system/xbin/tftp",
"/system/xbin/tftpd", "/system/xbin/time", "/system/xbin/timeout",
"/system/xbin/top", "/system/xbin/touch", "/system/xbin/tr",
"/system/xbin/traceroute6", "/system/xbin/true", "/system/xbin/tty",
"/system/xbin/ttysize", "/system/xbin/tunctl", "/system/xbin/ubiattach",
"/system/xbin/ubidetach", "/system/xbin/ubimkvol",
"/system/xbin/ubirmvol", "/system/xbin/ubirsvol",
"/system/xbin/ubiupdatevol", "/system/xbin/udpsvd",
"/system/xbin/umount", "/system/xbin/uname", "/system/xbin/unexpand",
"/system/xbin/uniq", "/system/xbin/unix2dos", "/system/xbin/unlzma",
"/system/xbin/unlzop", "/system/xbin/unxz", "/system/xbin/unzip",
"/system/xbin/uptime", "/system/xbin/usleep", "/system/xbin/uudecode",
"/system/xbin/uuencode", "/system/xbin/vconfig", "/system/xbin/vi",
"/system/xbin/volname", "/system/xbin/watch", "/system/xbin/watchdog",
"/system/xbin/wc", "/system/xbin/wget", "/system/xbin/which",
"/system/xbin/whoami", "/system/xbin/whois", "/system/xbin/xargs",
"/system/xbin/xz", "/system/xbin/xzcat", "/system/xbin/yes",
"/system/xbin/zcat",
"/system/xbin/zcip");
ui_print("Set permission...");
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_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm(0, 2000, 0755, "/system/vendor");
set_perm_recursive(0, 2000, 0755, 0755, "/system/vendor/bin");
set_perm(0, 2000, 0755, "/system/vendor/etc");
set_perm(0, 2000, 0755, "/system/vendor/etc/chargerimages");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/lib/drm");
set_perm(0, 0, 0644, "/system/vendor/lib/drm/libdrmwvmplugin.so");
set_perm(0, 2000, 0755, "/system/vendor/lib/egl");
set_perm(0, 2000, 0755, "/system/vendor/lib/hw");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/lib/mediadrm");
set_perm(0, 0, 0644, "/system/vendor/lib/mediadrm/libwvdrmengine.so");
set_perm(0, 2000, 0755, "/system/vendor/media");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models/detection");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models/detection/multi_pose_face_landmark_detectors.7");
set_perm(0, 2000, 0755, "/system/vendor/pittpatt/models/detection/yaw_roll_face_detectors.6");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/pittpatt/models/recognition");
set_perm(0, 0, 0644, "/system/vendor/pittpatt/models/recognition/face.face.y0-y0-22-b-N.bin");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/xbin/busybox");
set_perm(0, 0, 0644, "/system/xbin/miuioneshots");
set_perm(0, 1000, 0754, "/system/xbin/shelld");
set_perm(0, 0, 06755, "/system/xbin/su");
show_progress(0.200000, 0);
show_progress(0.200000, 10);
ui_print("Update Boot image...");
set_perm(0, 0, 0755, "/tmp/kernel.sh");
run_program("/tmp/kernel.sh");
delete("/tmp/kernel.sh");
package_extract_file("META-INF/com/miui/busybox", "/tmp/busybox");
set_perm(0, 0, 0555, "/tmp/busybox");
package_extract_file("META-INF/com/miui/replace_key", "/tmp/replace_key");
set_perm(0, 0, 0555, "/tmp/replace_key");
run_program("/sbin/sh", "/tmp/replace_key");
delete("/tmp/busybox");
delete("/tmp/replace_key");
package_extract_dir("data", "/data");
package_extract_file("META-INF/com/miui/relink", "/tmp/relink");
set_perm(0, 0, 0555, "/tmp/relink");
run_program("/tmp/relink");
delete("/tmp/relink");
set_perm_recursive(1000, 1000, 0755, 0644, "/data/miui");
set_metadata("/system/bin/debuggerd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/bin/debuggerd_vendor", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:debuggerd_exec:s0");
set_metadata("/system/xbin/su", "uid", 0, "gid", 2000, "mode", 06755, "capabilities", 0x0, "selabel", "u:object_r:su_exec:s0");
delete_recursive("/data/miui/preinstall_apps");
delete_recursive("/data/miui/cust/preinstall_apps");
unmount("/data");
unmount("/system");