ui_print(" ");
ui_print(" - mounting system partition");
run_program("/sbin/mount", "/system");
ui_print(" - mounting data partition");
run_program("/sbin/mount", "/data");

ui_print(" - flashing boot.img");
package_extract_file("boot.img","/dev/block/platform/msm_sdcc.1/by-name/boot");

ui_print(" - installing files");
package_extract_dir("system", "/system");
set_perm(0, 0, 0775, "/system/addon.d/97-kernel.sh");
run_program("/sbin/busybox", "rm", "/system/etc/permissions/android.hardware.audio.low_latency.xml");
run_program("/sbin/busybox", "rm", "-rf", "/system/vendor/lib/hw");

ui_print(" - tuning file systems");
run_program("/sbin/fstrim", "-v", "/system");
run_program("/sbin/fstrim", "-v", "/data");
run_program("/sbin/fstrim", "-v", "/cache");

ui_print(" - unmounting partition /data");
unmount("/data");

ui_print(" - unmounting partition /system");
unmount("/system");

ui_print(" ");
ui_print("finished");
run_program("/sbin/sync");
