[Android Q&A, Help & Troubleshooting] Moscow Desire:
Strange situation. Have a folder on internal SD, Which will not delete via PC nor ES File explorer.

Theoretically, there shouldn't need be permissions set, as far as I know, when doing an install routine via installer script to internal SD.

Install works fine. I can actually add files to the folder via installer, however, cannot delete the folder or files within. File Explorers show proper permissions as R/W.

Clues?

#Updater-script Evil Alex Purgatory V2
#For the ACER Iconia A701 Tab
set_progress(0.00);

ui_print("");
ui_print("");
ui_print("=================================");
ui_print(" Evil Alex Roms by Moscow Desire ");
ui_print(" 1st boot may take a while! ");
ui_print(" 1. Boot kann lang dauern! ");
ui_print("=================================");
ui_print("");
ui_print("");

set_progress(0.01);

############################################################
# Mount Partitions
############################################################
ui_print("--- Mounting partitions ---");
mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/APP", "/system");
mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/UDA", "/data");
mount("ext4", "EMMC", "/dev/block/platform/sdhci-tegra.3/by-name/FLX", "/flex");
mount("vfat", "EMMC", "/dev/fuse /storage/sdcard0", "/sdcard");

############################################################
# Cleaning System
############################################################
ui_print("");
ui_print("");
ui_print("--- Cleaning process ---");
# Delete/Wipe /data partition without sd-card content !!! thx [MENTION=287340]Vorbeth[/MENTION]
delete_recursive("/system");
if
file_getprop("/tmp/aroma-data/wipe.prop","selected.0") == "2"
then
ui_print("--- Cleaning data ---");
package_extract_file("aroma/scripts/wipe-data.sh", "/tmp/wipe-data.sh");
set_perm(0, 0, 0777, "/tmp/wipe-data.sh");
run_program("/tmp/wipe-data.sh");
delete_recursive("/data/media/Android");
delete_recursive("/data/media/LazyList");
delete_recursive("/data/media/LOST.DIR");
delete_recursive("/data/media/bugreports");
delete_recursive("/data/media/tmp");
else
ui_print("--- Cleaning caches ---");
delete_recursive("/data/dalvik-cache");
delete_recursive("/data/resource-cache");
endif;

set_progress(0.10);
############################################################
# 0 Install Stock Rom
############################################################
ui_print(" ");
ui_print("********** Evil Alex INSTALL SYSTEM *************");
ui_print("");
package_extract_dir("system", "/system");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");
symlink("/system/xbin/busybox", "/system/bin/busybox");

ui_print(" ");
ui_print("*********** Evil Alex ROM COPY DATA **************");
ui_print(" ");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");

[COLOR="Red"]	ui_print("*********** Installing Viper4Android **************");
package_extract_dir("aroma/audio", "/sdcard");[/COLOR]

set_progress(0.35);

############################################################
# 1 Install Full Stock Rom
############################################################

if
file_getprop("/tmp/aroma-data/typeinst.prop","selected.0") == "1"
then

set_progress(0.35);

ui_print(" ");
ui_print("*********** install Purgatory Mods **************");
ui_print(" ");

ui_print("Install 4Way Reboot Mod");
package_extract_dir("aroma/mods/4Way", "/system");
ui_print("Install Chrome Desktop Mode");
package_extract_dir("aroma/mods/ccl", "/data");
set_perm(1000, 1000, 0755, "/data/local/chrome-command-line");
ui_print("Install GPU Rendering");
package_extract_file("aroma/mods/81GPU_rendering", "/system/etc/init.d/81GPU_rendering");

endif;

############################################################
# 2 Install small Rom and delete Apps
############################################################

if
file_getprop("/tmp/aroma-data/typeinst.prop","selected.0") == "2"
then

ui_print(" ");
ui_print("*********** install Purgatory Mods **************");
ui_print(" ");

ui_print("Install 4Way Reboot Mod");
package_extract_dir("aroma/mods/4Way", "/system");
ui_print("Install Chrome Desktop Mode");
package_extract_dir("aroma/mods/ccl", "/data");
set_perm(1000, 1000, 0755, "/data/local/chrome-command-line");
ui_print("Install GPU Rendering Tweak");
package_extract_file("aroma/mods/81GPU_rendering", "/system/etc/init.d/81GPU_rendering");

ui_print(" ");
ui_print("******* Purgatory small Edition *********");
ui_print(" ");

delete_recursive("/system/app/AcerCloud.apk");
delete_recursive("/data/app/Files.apk");
delete_recursive("/system/app/AcerPrint.apk");
delete_recursive("/data/app/AcerEurosport.apk");

delete_recursive("/system/app/AcerRing.apk");
delete_recursive("/system/app/AcerShellData.apk");
package_extract_file("aroma/scripts/change-shell.sh", "/tmp/change-shell.sh");
set_perm(0, 0, 0777, "/tmp/change-shell.sh");

delete_recursive("/data/app/McAfee.apk");
###
delete_recursive("/data/app/7digital.apk");
delete_recursive("/data/app/Acetrax_Movies.apk");
delete_recursive("/data/app/aupeo.apk");
delete_recursive("/data/app/BarcodeScanner.apk");
delete_recursive("/data/app/Books.apk");

delete_recursive("/system/app/clearfi_music.apk");
delete_recursive("/system/app/clearfi_photo.apk");
delete_recursive("/system/app/clearfi_video.apk");

delete_recursive("/data/app/EquiView.apk");
delete_recursive("/data/app/Evernote.apk");
delete_recursive("/data/app/Kindle.apk");
delete_recursive("/data/app/Calendar.apk");

delete_recursive("/system/app/PolarisOfficeForAcer4.0_JB.apk");
delete_recursive("/system/app/libpolarisoffice_tablet_jb.so");
delete_recursive("/system/app/libtfapps-polaris.so");
delete_recursive("/system/app/libtflua-polaris.so");

delete_recursive("/system/app/Gallery2.apk");
delete_recursive("/data/app/TegraZone.apk");
delete_recursive("/data/app/Youtube.apk");

delete_recursive("/data/app/ZinioReader.apk");
delete_recursive("/data/app/ZinioSettingsProvider.apk");

####
delete_recursive("/data/app/Monopoly.apk");

delete_recursive("/data/app/RealRacing2.apk");

delete_recursive("/system/app/Solitaire.apk");
delete_recursive("/system/app/libHardwoodSolitaireIV.so");
delete_recursive("/system/app/libHardwoodSolitaireIVRogue.so");

####
delete_recursive("/data/app/DigitalClockWidget2.apk");
delete_recursive("/data/app/WeatherWidget2.apk");

endif;

set_progress(0.75);

############################################################
# 3 Install Custom Rom delete Stock Apps
############################################################

if
file_getprop("/tmp/aroma-data/typeinst.prop","selected.0") == "3"
then

set_progress(0.35);

####Acer Deinstall####

if
file_getprop("/tmp/aroma-data/customdel.prop","item.1.1") == "1"
then
ui_print("delete AcerCloud");
delete_recursive("/system/app/AcerCloud.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.1.2") == "1"
then
ui_print("delete AcerCloud");
delete_recursive("/data/app/AcerEurosport.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.1.3") == "1"
then
ui_print("delete Acer File Browser");
delete_recursive("/data/app/Files.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.1.4") == "1"
then
ui_print("delete Acer Print");
delete_recursive("/system/app/AcerPrint.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.1.5") == "1"
then
ui_print("delete Acer Shell");
delete_recursive("/system/app/AcerRing.apk");
delete_recursive("/system/app/AcerShellData.apk");
package_extract_file("aroma/scripts/change-shell.sh", "/tmp/change-shell.sh");
set_perm(0, 0, 0777, "/tmp/change-shell.sh");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.1.6") == "1"
then
ui_print("delete McAfee");
delete_recursive("/data/app/McAfee.apk");
endif;
set_progress(0.45);

####Apps Deinstall####

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.1") == "1"
then
ui_print("delete 7digital");
delete_recursive("/data/app/7digital.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.2") == "1"
then
ui_print("delete Acetrax Movies");
delete_recursive("/data/app/Acetrax_Movies.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.3") == "1"
then
ui_print("delete Amazon Kindle");
delete_recursive("/data/app/Kindle.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.4") == "1"
then
ui_print("delete Aupeo");
delete_recursive("/data/app/aupeo.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.5") == "1"
then
ui_print("delete BarcodeScanner");
delete_recursive("/data/app/BarcodeScanner.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.6") == "1"
then
ui_print("delete Google Books");
delete_recursive("/data/app/Books.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.7") == "1"
then
ui_print("delete ClearFi Apps");
delete_recursive("/system/app/clearfi_music.apk");
delete_recursive("/system/app/clearfi_photo.apk");
delete_recursive("/system/app/clearfi_video.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.8") == "1"
then
ui_print("delete EquiView");
delete_recursive("/data/app/EquiView.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.9") == "1"
then
ui_print("delete Evernote");
delete_recursive("/data/app/Evernote.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.10") == "1"
then
ui_print("delete Google Calendar");
delete_recursive("/data/app/Calendar.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.11") == "1"
then
ui_print("delete Polaris Office");
delete_recursive("/system/app/PolarisOfficeForAcer4.0_JB.apk");
delete_recursive("/system/app/libpolarisoffice_tablet_jb.so");
delete_recursive("/system/app/libtfapps-polaris.so");
delete_recursive("/system/app/libtflua-polaris.so");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.12") == "1"
then
ui_print("delete Stock Gallery");
delete_recursive("/system/app/Gallery2.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.13") == "1"
then
ui_print("delete Youtube Appe");
delete_recursive("/data/app/TegraZone.apk");
endif;
if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.14") == "1"
then
ui_print("delete Youtube Appe");
delete_recursive("/data/app/Youtube.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.2.15") == "1"
then
ui_print("delete Zinio Reader");
delete_recursive("/data/app/ZinioReader.apk");
delete_recursive("/data/app/ZinioSettingsProvider.apk");
endif;
set_progress(0.55);

####Games Deinstall####

if
file_getprop("/tmp/aroma-data/customdel.prop","item.3.1") == "1"
then
ui_print("delete Monopoly");
delete_recursive("/data/app/Monopoly.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.3.2") == "1"
then
ui_print("delete Real Racing 2");
delete_recursive("/data/app/RealRacing2.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.3.3") == "1"
then
ui_print("delete Solitaire");
delete_recursive("/system/app/Solitaire.apk");
delete_recursive("/system/app/libHardwoodSolitaireIV.so");
delete_recursive("/system/app/libHardwoodSolitaireIVRogue.so");
endif;
####Widget Deinstall####

if
file_getprop("/tmp/aroma-data/customdel.prop","item.4.1") == "1"
then
ui_print("delete Digital Clock Widget");
delete_recursive("/data/app/Digitalclock2.apk");
endif;

if
file_getprop("/tmp/aroma-data/customdel.prop","item.4.2") == "1"
then
ui_print("delete Weather Widget");
delete_recursive("/data/app/Weather2.apk");
endif;

endif;

set_progress(0.75);

############################################################
# 4 Install custom Rom choosed Mods
############################################################

if
file_getprop("/tmp/aroma-data/typeinst.prop","selected.0") == "3"
then

if
file_getprop("/tmp/aroma-data/tweaks.prop","item.0.1") == "1"
then
ui_print("Install 4Way Reboot Mod");
package_extract_dir("aroma/mods/4Way", "/system");
endif;

if
file_getprop("/tmp/aroma-data/tweaks.prop","item.0.2") == "1"
then
ui_print("Install Chrome Desktop Mode");
package_extract_dir("aroma/mods/ccl", "/data");
set_perm(1000, 1000, 0755, "/data/local/chrome-command-line");
endif;

if
file_getprop("/tmp/aroma-data/tweaks.prop","item.0.3") == "1"
then
ui_print("Install GPU Rendering Tweak");
package_extract_file("aroma/mods/81GPU_rendering", "/system/etc/init.d/81GPU_rendering");
endif;

endif;

set_progress(0.80);

############################################################
# 5 Install Custom Apps
############################################################

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.1") == "1"
then
ui_print("Install AdAway");
package_extract_dir("Apps/AdAway", "/system/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.2") == "1"
then
ui_print("Install Rootchecker");
package_extract_dir("Apps/RootChecker", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.3") == "1"
then
ui_print("Install Flashplayer");
package_extract_dir("Apps/Flashplayer", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.4") == "1"
then
ui_print("Install Quickpic");
package_extract_dir("Apps/Quickpic", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.5") == "1"
then
ui_print("Install Chrome");
package_extract_dir("Apps/Chrome", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.6") == "1"
then
ui_print("Install DroidEdit");
package_extract_dir("Apps/DroidEdit", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.7") == "1"
then
ui_print("Install BBS");
package_extract_dir("Apps/BBS", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.8") == "1"
then
ui_print("Install BSPlayer");
package_extract_dir("Apps/BSPlayer", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.9") == "1"
then
ui_print("Install CpuSpy");
package_extract_dir("Apps/CpuSpy", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.10") == "1"
then
ui_print("Install ESExplorer");
package_extract_dir("Apps/ESExplorer", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.11") == "1"
then
ui_print("Install K9");
package_extract_dir("Apps/K9", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.12") == "1"
then
ui_print("Install Titanium");
package_extract_dir("Apps/Titanium", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.13") == "1"
then
ui_print("Install RoleTube");
package_extract_dir("Apps/RoleTube", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.14") == "1"
then
ui_print("Install NoteEverything");
package_extract_dir("Apps/NoteEverything", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.15") == "1"
then
ui_print("Install Dolphin");
package_extract_dir("Apps/Dolphin", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.16") == "1"
then
ui_print("Install UncoptExplorer");
package_extract_dir("Apps/UncoptExplorer", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.17") == "1"
then
ui_print("Install SonyWalkman");
package_extract_dir("Apps/SonyWalkman", "/data/app");
endif;

if
file_getprop("/tmp/aroma-data/customapp.prop","item.0.18") == "1"
then
ui_print("Install RealCalc");
package_extract_dir("Apps/RealCalc", "/data/app");
endif;

set_progress(0.85);

set_progress(0.90);

############################################################
# 8 Install Launcher
############################################################

ui_print("Launcher");
if
file_getprop("/tmp/aroma-data/launcher.prop","item.0.1") == "1"
then
ui_print(" - Stock Launcher");
package_extract_dir("aroma/launchers/stock", "/system");
endif;
if
file_getprop("/tmp/aroma-data/launcher.prop","item.0.2") == "1"
then
ui_print(" - Apex Launcher");
package_extract_dir("aroma/launchers/apex", "/system");
endif;
if
file_getprop("/tmp/aroma-data/launcher.prop","item.0.3") == "1"
then
ui_print(" - Nova Launcher");
package_extract_dir("aroma/launchers/nova", "/system");
endif;
if
file_getprop("/tmp/aroma-data/launcher.prop","item.0.4") == "1"
then
ui_print(" - ADW Launcher");
package_extract_dir("aroma/launchers/adw", "/system");
endif;
if
file_getprop("/tmp/aroma-data/launcher.prop","item.0.5") == "1"
then
ui_print(" - GO Launcher HD");
package_extract_dir("aroma/launchers/golhd", "/system");
endif;

set_progress(0.6);

############################################################
# 10 Install Rings
############################################################

ui_print("Acer Ring");
if
file_getprop("/tmp/aroma-data/ring.prop","item.0.1") == "1"
then
ui_print(" - Stock Acer Ring");
package_extract_dir("aroma/Rings/Stock", "/system/app");
endif;
if
file_getprop("/tmp/aroma-data/ring.prop","item.0.2") == "1"
then
ui_print(" - Carbon Ring");
package_extract_dir("aroma/Rings/Carbon", "/system/app");
endif;
if
file_getprop("/tmp/aroma-data/ring.prop","item.0.3") == "1"
then
ui_print(" - Bones Ring");
package_extract_dir("aroma/Rings/Bones", "/system/app");
endif;

############################################################
# Symlink Permission Recovery
############################################################

ui_print("Symlinking ...");
symlink("toolbox", "/system/bin/cat");
symlink("toolbox", "/system/bin/chmod");
symlink("toolbox", "/system/bin/chown");
symlink("toolbox", "/system/bin/chownto");
symlink("toolbox", "/system/bin/cmp");
symlink("toolbox", "/system/bin/date");
symlink("toolbox", "/system/bin/dd");
symlink("toolbox", "/system/bin/df");
symlink("toolbox", "/system/bin/dmesg");
symlink("toolbox", "/system/bin/getevent");
symlink("toolbox", "/system/bin/getprop");
symlink("toolbox", "/system/bin/hd");
symlink("toolbox", "/system/bin/id");
symlink("toolbox", "/system/bin/ifconfig");
symlink("toolbox", "/system/bin/iftop");
symlink("toolbox", "/system/bin/insmod");
symlink("toolbox", "/system/bin/ioctl");
symlink("toolbox", "/system/bin/ionice");
symlink("toolbox", "/system/bin/kill");
symlink("toolbox", "/system/bin/ln");
symlink("toolbox", "/system/bin/log");
symlink("toolbox", "/system/bin/ls");
symlink("toolbox", "/system/bin/lsmod");
symlink("toolbox", "/system/bin/lsof");
symlink("toolbox", "/system/bin/md5");
symlink("toolbox", "/system/bin/mkdir");
symlink("toolbox", "/system/bin/mount");
symlink("toolbox", "/system/bin/mv");
symlink("toolbox", "/system/bin/nandread");
symlink("toolbox", "/system/bin/netstat");
symlink("toolbox", "/system/bin/newfs_msdos");
symlink("toolbox", "/system/bin/notify");
symlink("toolbox", "/system/bin/printenv");
symlink("toolbox", "/system/bin/ps");
symlink("toolbox", "/system/bin/r");
symlink("toolbox", "/system/bin/reboot");
symlink("toolbox", "/system/bin/renice");
symlink("toolbox", "/system/bin/rm");
symlink("toolbox", "/system/bin/rmdir");
symlink("toolbox", "/system/bin/rmmod");
symlink("toolbox", "/system/bin/route");
symlink("toolbox", "/system/bin/schedtop");
symlink("toolbox", "/system/bin/sendevent");
symlink("toolbox", "/system/bin/setconsole");
symlink("toolbox", "/system/bin/setprop");
symlink("toolbox", "/system/bin/sleep");
symlink("toolbox", "/system/bin/smd");
symlink("toolbox", "/system/bin/start");
symlink("toolbox", "/system/bin/stop");
symlink("toolbox", "/system/bin/sync");
symlink("toolbox", "/system/bin/top");
symlink("toolbox", "/system/bin/touch");
symlink("toolbox", "/system/bin/umount");
symlink("toolbox", "/system/bin/uptime");
symlink("toolbox", "/system/bin/vmstat");
symlink("toolbox", "/system/bin/watchprops");
symlink("toolbox", "/system/bin/wipe");

ui_print("");
ui_print("");
ui_print("--- Creating additional symlinks");
symlink("/system/bin/mksh", "/system/bin/sh");
symlink("/system/fonts/Roboto-Regular.ttf","/system/fonts/DroidSans.ttf");
symlink("/system/fonts/Roboto-Bold.ttf","/system/fonts/DroidSans-Bold.ttf");

ui_print("");
ui_print("");
ui_print("--- Installing busybox");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
run_program("/system/xbin/busybox", "--install", "-s", "/system/xbin");

ui_print("");
ui_print("");
ui_print("--- Setting permissions");
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, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
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(0, 0, 0644, "/system/etc/bluetooth/bdaddr");
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_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm(0, 0, 0644, "/system/vendor/fake.txt");
set_perm_recursive(0, 2000, 0755, 0755, "/system/etc/init.d");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 0700, "/system/xbin/tcpdump");
set_perm(1000, 1000, 0755, "/system/xbin/sysro");
set_perm(1000, 1000, 0755, "/system/xbin/sysrw");
set_perm(0, 0, 06755, "/system/xbin/su");
set_perm(1000, 1000, 0771, "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
set_perm_recursive(0, 0, 0755, 0644, "/system/vendor");
ui_print("--- End Setting permissions");

set_progress(0.95);

############################################################
# 6 Finish Rom Install
############################################################
ui_print("");
ui_print("");
ui_print("--- Flashing boot img");
package_extract_file("boot.img", "/dev/block/platform/sdhci-tegra.3/by-name/LNX");

ui_print("");
ui_print("");
ui_print("--- Unmounting partitions");
ifelse(is_mounted("/system") == "/system", unmount("/system"));
ifelse(is_mounted("/data") == "/data", unmount("/data"));

ui_print("");
ui_print("");

############################################################
# 7 Flash Firmware
############################################################

if file_getprop("/tmp/aroma-data/firmw.prop","selected.0") == "2" then
ui_print("--- Installing New Firmware");
package_extract_dir("firmware/TouchFw", "/tmp");
set_perm(0, 2000, 0777, "/tmp/atmel-ap");
set_perm(0, 2000, 0777, "/tmp/fw-1386e-22F4");
set_perm(0, 2000, 0777, "/tmp/1386e-config.txt");
run_program("/tmp/atmel-ap","0","1","76","/dev/maXTouch","/tmp/fw-1386e-22F4");
run_program("/tmp/atmel-ap","1","1","76","/tmp/1386e-config.txt","1","/dev/maXTouch");
package_extract_file("firmware/bootloader.blob", "/dev/block/platform/sdhci-tegra.3/by-name/USP");
run_program("/sbin/sleep", "2");
set_progress(1.0);
run_program("/sbin/reboot");
endif;

ui_print("=================================");
ui_print(" Evil Alex Purgatory Installed!");
ui_print(" Buy me some Beers if you like!! ");
ui_print(" Enjoy!! ");
ui_print("=================================");

set_progress(1.0);