ui_print("------------------------------------------------");
ui_print("     Hard Swap Flasher by Yank555.lu - v2.3     ");
ui_print("            for htc Desire HD                   ");
ui_print("------------------------------------------------");

ui_print(" - mounting system partition");
mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/system");
show_progress(0.100000, 0);

ui_print(" - mounting data partition");
mount("ext4", "EMMC", "/dev/block/mmcblk0p26", "/data");
show_progress(0.100000, 0);

ui_print(" - extracting installation files");
package_extract_dir("setup","/tmp");
set_perm_recursive(0, 0, 0777, 0777, "/tmp/install");
show_progress(0.100000, 0);

ui_print(" - starting installation script");
run_program("/tmp/install/install.sh");
show_progress(0.740000, 0);

if file_getprop("/tmp/install/hardswap.prop","swap.present") == "yes"
  then
    ui_print(" - swap partition found on SD-card");
    ui_print("   '",file_getprop("/tmp/install/hardswap.prop","swap.device"),"'");
    if file_getprop("/tmp/install/hardswap.prop","swap.formated") == "yes"
      then
        ui_print(" - swap partition formated");
    endif;
    if file_getprop("/tmp/install/hardswap.prop","swap.scriptinstalled") == "yes"
      then
        ui_print(" - swap activation script installed to init.d");
    endif;
  else
    ui_print("   Problem, no swap partiton found !");
    ui_print("   --> Installation aborted.");
endif;

ui_print(" - removing installation files");
delete_recursive(/tmp/install);
delete_recursive(/tmp/init.d);
show_progress(0.100000, 0);

ui_print(" - unmounting partition /data");
unmount("/data");	
show_progress(0.100000, 0);

ui_print(" - unmounting partition /system");
unmount("/system");	
show_progress(0.100000, 0);

ui_print("                                          done.");
ui_print("------------------------------------------------");
