#OMJ updater-script

set_progress(0.00);

ui_print("-Checking Model ID");
assert(getprop("ro.product.device") == "jewel" || getprop("ro.build.product") == "jewel" || getprop("ro.product.board") == "jewel");
ui_print("-Success!");
ui_print("-Model ID - HTC Evo 4g LTE");
ui_print("-Ok to proceed");
ui_print("Now flashing OMJs MOD Pack ");
ifelse(is_mounted("/system") == "/system", unmount("/system"));
ifelse(is_mounted("/data")   == "/data",   unmount("/data"));
ifelse(is_mounted("/cache")   == "/cache",   unmount("/cache"));

run_program("/sbin/busybox", "mount", "/system");
run_program("/sbin/busybox", "mount", "/data");

set_progress(0.10);

ui_print("@Installing MOD Pack");
ui_print(" ");

set_progress(0.50);

# Running user choice settings. 
ui_print(" ");
ui_print("@Adding User Choice Packages");

if
    file_getprop("/tmp/aroma-data/custom.prop","item.1.1") == "1"
then
	ui_print("-> Adding Custom Battery");
	
if file_getprop("/tmp/aroma-data/battery.prop","selected") == "1" then
	ui_print("-> Adding Circle w/Percent Battery");
			package_extract_dir("customize/battery/circlepercent/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");
endif;
if file_getprop("/tmp/aroma-data/battery.prop","selected") == "2" then
	ui_print("-> Adding Circle 2 w/Percent Battery");
			package_extract_dir("customize/battery/circlepercent2/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");
endif;
if file_getprop("/tmp/aroma-data/battery.prop","selected") == "3" then
	ui_print("-> Adding Stock Sense w/ no Percent Battery");
			package_extract_dir("customize/battery/stock/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");
endif;
if file_getprop("/tmp/aroma-data/battery.prop","selected") == "4" then
	ui_print("-> Adding Stock Sense w/Percent Battery");
			package_extract_dir("customize/battery/stockpercent/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");
endif;
if file_getprop("/tmp/aroma-data/battery.prop","selected") == "5" then
	ui_print("-> Adding Blue Stock Sense w/Percent Battery");
			package_extract_dir("customize/battery/bluepercent/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");
endif;
if file_getprop("/tmp/aroma-data/battery.prop","selected") == "6" then
	ui_print("-> Adding Honeycomb w/Percent Battery");
		package_extract_dir("customize/battery/honeycomb/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");
endif;
if file_getprop("/tmp/aroma-data/battery.prop","selected") == "7" then
	ui_print("-> Adding Sense 5 w/Percent Battery");
		package_extract_dir("customize/battery/sense5/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");
endif;

endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.2.1") == "1"
then
	ui_print("-> Adding App drawer");
          package_extract_dir("customize/5x6_drawer", "/system/");
endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.3.1") == "1"
then
	ui_print("-> Adding the Roam only option");
			package_extract_dir("customize/roam", "/system");
endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.3.2") == "1"
then
	ui_print("->Installing Exchange Security option");
			package_extract_dir("customize/exchange_security", "/system");
endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.3.3") == "1"
then
	ui_print("-> Adding MMS Awake option");
          package_extract_dir("customize/mms_awake/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");

endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.4.1") == "1"
then
	ui_print("->Increasing haptic feedback");
			package_extract_dir("customize/haptic", "/system");
endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.4.2") == "1"
then
	ui_print("-> Adding Camera Button Options");
	
	if file_getprop("/tmp/aroma-data/camera.prop","selected.0") == "1" then
		ui_print("-> Remapping half press Camera->Wake");
			package_extract_dir("customize/camera/camerawake", "/system");
	endif;
		if file_getprop("/tmp/aroma-data/camera.prop","selected.0") == "2" then
			ui_print("-> Remapping half press Camera->Search");
				package_extract_dir("customize/camera/camerasearch", "/system");
		endif;
			if file_getprop("/tmp/aroma-data/camera.prop","selected.0") == "3" then
				ui_print("-> Remapping half press Camera->Wake & Search");
					package_extract_dir("customize/camera/cameraboth", "/system");
			endif;
				if file_getprop("/tmp/aroma-data/camera.prop","selected.0") == "4" then
				ui_print("-> Reverting to stock");
					package_extract_dir("customize/camera/camerastock", "/system");
			endif;
endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.4.3") == "1"
then
	ui_print("-> Adding Stock JellyBean Boot Animation");
  			package_extract_dir("customize/bootanim", "/system");
endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.4.4") == "1"
then
	ui_print("-> Installing Icon Pack option");
		ui_print("-> Installing JB Icon Pack option");
		 package_extract_dir("customize/blue_icons/vrtheme", "/cache/vrtheme/");
         set_perm(0, 0, 0755, "/cache/vrtheme/installtheme.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zip");
		 set_perm(0, 0, 0755, "/cache/vrtheme/cleanup.sh");
		 set_perm(0, 0, 0755, "/cache/vrtheme/zipalign");
         run_program("/cache/vrtheme/installtheme.sh");
		 run_program("/cache/vrtheme/cleanup.sh");
endif;

if
    file_getprop("/tmp/aroma-data/custom.prop","item.4.5") == "1"
then
	ui_print("->Set Capacitive Brightness");
	
	if file_getprop("/tmp/aroma-data/led.prop","selected.0") == "1" then
			package_extract_dir("customize/leds/off", "/system");
	endif;	
	if file_getprop("/tmp/aroma-data/led.prop","selected.0") == "2" then
			package_extract_dir("customize/leds/dim", "/system");
	endif;		
	if file_getprop("/tmp/aroma-data/led.prop","selected.0") == "3" then
			package_extract_dir("customize/leds/stock", "/system");
	endif;	
endif;

set_progress(1.00);
ui_print("Done! I hope you enjoy OMJs MOD Pack!!");
ui_print(" ");
ui_print("Thank you to all that have contributed!!!");
ui_print(" ");
unmount("/system");
unmount("/data");
