diff options
Diffstat (limited to '')
-rw-r--r-- | gui/devices/1024x600/res/ui.xml | 1 | ||||
-rw-r--r-- | gui/devices/1024x768/res/ui.xml | 1 | ||||
-rw-r--r-- | gui/devices/1280x800/res/ui.xml | 1 | ||||
-rw-r--r-- | gui/devices/1920x1200/res/ui.xml | 1 | ||||
-rw-r--r-- | gui/devices/2560x1600/res/ui.xml | 1 | ||||
-rw-r--r-- | gui/devices/320x480/res/images/slider-touch.png | bin | 4445 -> 3781 bytes | |||
-rw-r--r-- | gui/devices/320x480/res/images/slider-used.png | bin | 1943 -> 1728 bytes | |||
-rw-r--r-- | gui/devices/320x480/res/images/slider.png | bin | 3028 -> 2611 bytes | |||
-rw-r--r-- | gui/devices/320x480/res/ui.xml | 4 | ||||
-rw-r--r-- | gui/devices/800x480/res/ui.xml | 1 | ||||
-rw-r--r-- | gui/devices/landscape/res/landscape.xml | 8 | ||||
-rw-r--r-- | gui/devices/portrait/res/portrait.xml | 8 | ||||
-rw-r--r-- | gui/devices/watch/res/watch.xml | 10 | ||||
-rw-r--r-- | partitionmanager.cpp | 51 | ||||
-rw-r--r-- | partitions.hpp | 2 |
15 files changed, 80 insertions, 9 deletions
diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index e76cc950c..725e11fcc 100644 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -101,6 +101,7 @@ <variable name="nandcheck_row5" value="330" /> <variable name="nandcheck_row6" value="375" /> <variable name="nandcheck_row7" value="410" /> + <variable name="nandcheck_row8" value="445" /> <variable name="button_text_color" value="#AAAAAA" /> <variable name="text_color" value="#A0A0A0" /> <variable name="text_success_color" value="#33B5E5" /> diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index cfaf48e00..683be26f1 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -101,6 +101,7 @@ <variable name="nandcheck_row5" value="350" /> <variable name="nandcheck_row6" value="400" /> <variable name="nandcheck_row7" value="450" /> + <variable name="nandcheck_row8" value="500" /> <variable name="button_text_color" value="#AAAAAA" /> <variable name="text_color" value="#A0A0A0" /> <variable name="text_success_color" value="#33B5E5" /> diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index 0c7ecf0b9..ddcdb3f64 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -101,6 +101,7 @@ <variable name="nandcheck_row5" value="350" /> <variable name="nandcheck_row6" value="400" /> <variable name="nandcheck_row7" value="450" /> + <variable name="nandcheck_row8" value="500" /> <variable name="button_text_color" value="#AAAAAA" /> <variable name="text_color" value="#A0A0A0" /> <variable name="text_success_color" value="#33B5E5" /> diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index 05a3ee62b..2407905bf 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -101,6 +101,7 @@ <variable name="nandcheck_row5" value="500" /> <variable name="nandcheck_row6" value="575" /> <variable name="nandcheck_row7" value="650" /> + <variable name="nandcheck_row8" value="725" /> <variable name="button_text_color" value="#AAAAAA" /> <variable name="text_color" value="#A0A0A0" /> <variable name="text_success_color" value="#33B5E5" /> diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index 57945cb77..8f699ee28 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -101,6 +101,7 @@ <variable name="nandcheck_row5" value="660" /> <variable name="nandcheck_row6" value="760" /> <variable name="nandcheck_row7" value="860" /> + <variable name="nandcheck_row8" value="960" /> <variable name="button_text_color" value="#AAAAAA" /> <variable name="text_color" value="#A0A0A0" /> <variable name="text_success_color" value="#33B5E5" /> diff --git a/gui/devices/320x480/res/images/slider-touch.png b/gui/devices/320x480/res/images/slider-touch.png Binary files differindex 2f36fa7cc..77cb80975 100644 --- a/gui/devices/320x480/res/images/slider-touch.png +++ b/gui/devices/320x480/res/images/slider-touch.png diff --git a/gui/devices/320x480/res/images/slider-used.png b/gui/devices/320x480/res/images/slider-used.png Binary files differindex 94a09f3bd..85c2f4368 100644 --- a/gui/devices/320x480/res/images/slider-used.png +++ b/gui/devices/320x480/res/images/slider-used.png diff --git a/gui/devices/320x480/res/images/slider.png b/gui/devices/320x480/res/images/slider.png Binary files differindex 5cbb27e2f..2d09187f4 100644 --- a/gui/devices/320x480/res/images/slider.png +++ b/gui/devices/320x480/res/images/slider.png diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index d91df4207..de2c13632 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -94,8 +94,8 @@ <variable name="row5_medium_y" value="258" /> <variable name="row6_medium_y" value="303" /> <variable name="row7_medium_y" value="348" /> - <variable name="slider_x" value="39" /> - <variable name="slider_y" value="400" /> + <variable name="slider_x" value="55" /> + <variable name="slider_y" value="410" /> <variable name="slider_text_y" value="425" /> <variable name="button_text_color" value="#AAAAAA" /> <variable name="text_color" value="#FFFFFF" /> diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index faa0878b7..5c9f07dfa 100644 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -101,6 +101,7 @@ <variable name="nandcheck_row5" value="250" /> <variable name="nandcheck_row6" value="280" /> <variable name="nandcheck_row7" value="310" /> + <variable name="nandcheck_row8" value="340" /> <variable name="button_text_color" value="#AAAAAA" /> <variable name="text_color" value="#A0A0A0" /> <variable name="text_success_color" value="#33B5E5" /> diff --git a/gui/devices/landscape/res/landscape.xml b/gui/devices/landscape/res/landscape.xml index fd5fcfe42..c5d29966f 100644 --- a/gui/devices/landscape/res/landscape.xml +++ b/gui/devices/landscape/res/landscape.xml @@ -1623,6 +1623,14 @@ <data variable="tw_skip_md5_generate" /> </object> + <object type="checkbox"> + <placement x="%col3_x%" y="%nandcheck_row8%" /> + <font resource="font" color="%text_color%" /> + <text>Disable Free Space Check.</text> + <data variable="tw_disable_free_space" /> + <image checked="checkbox_true" unchecked="checkbox_false" /> + </object> + <object type="slider"> <text>Swipe to Back Up</text> <actions> diff --git a/gui/devices/portrait/res/portrait.xml b/gui/devices/portrait/res/portrait.xml index 6fb52f300..315b5a8fd 100644 --- a/gui/devices/portrait/res/portrait.xml +++ b/gui/devices/portrait/res/portrait.xml @@ -1402,6 +1402,14 @@ <data variable="tw_skip_md5_generate" /> </object> + <object type="checkbox"> + <placement x="%col1_x%" y="%row17_text_y%" /> + <font resource="font" color="%text_color%" /> + <text>Disable Free Space Check.</text> + <data variable="tw_disable_free_space" /> + <image checked="checkbox_true" unchecked="checkbox_false" /> + </object> + <object type="slider"> <text>Swipe to Back Up</text> <action function="page">backup_run</action> diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml index 1d4e2907f..dfbed16cd 100644 --- a/gui/devices/watch/res/watch.xml +++ b/gui/devices/watch/res/watch.xml @@ -1415,11 +1415,19 @@ </object> <object type="checkbox"> - <placement x="%col1_x%" y="%row4_text_y%" /> + <placement x="%col1_x%" y="%row3_text_y%" /> <text>Skip MD5 generation during backup.</text> <data variable="tw_skip_md5_generate" /> </object> + <object type="checkbox"> + <placement x="%col1_x%" y="%row4_text_y%" /> + <font resource="font" color="%text_color%" /> + <text>Disable Free Space Check.</text> + <data variable="tw_disable_free_space" /> + <image checked="checkbox_true" unchecked="checkbox_false" /> + </object> + <object type="action"> <touch key="home" /> <action function="page">main</action> diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 25f9dc7ae..098169c3b 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -526,6 +526,8 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde float pos; unsigned long long total_size, current_size; + string backup_log = Backup_Folder + "recovery.log"; + if (Part == NULL) return true; @@ -574,6 +576,9 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde if ((*subpart)->Can_Be_Backed_Up && (*subpart)->Is_SubPartition && (*subpart)->SubPartition_Of == Part->Mount_Point) { if (!(*subpart)->Backup(Backup_Folder, &total_size, ¤t_size, tar_fork_pid)) { TWFunc::SetPerformanceMode(false); + Clean_Backup_Folder(Backup_Folder); + TWFunc::copy_file("/tmp/recovery.log", backup_log, 0644); + tw_set_default_metadata(backup_log.c_str()); return false; } sync(); @@ -608,12 +613,44 @@ bool TWPartitionManager::Backup_Partition(TWPartition* Part, string Backup_Folde TWFunc::SetPerformanceMode(false); return md5Success; } else { + Clean_Backup_Folder(Backup_Folder); + TWFunc::copy_file("/tmp/recovery.log", backup_log, 0644); + tw_set_default_metadata(backup_log.c_str()); TWFunc::SetPerformanceMode(false); return false; } return 0; } +void TWPartitionManager::Clean_Backup_Folder(string Backup_Folder) { + DIR *d = opendir(Backup_Folder.c_str()); + struct dirent *p; + int r; + + gui_print("Backup Failed.\nCleaning Backup Folder\n"); + + if (d == NULL) { + LOGERR("Error opening dir: '%s'\n", Backup_Folder.c_str()); + return; + } + + while (p = readdir(d)) { + if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) + continue; + + string path = Backup_Folder + p->d_name; + + size_t dot = path.find_last_of(".") + 1; + if (path.substr(dot) == "win" || path.substr(dot) == "md5" || path.substr(dot) == "info") { + r = unlink(path.c_str()); + if (r != 0) { + LOGINFO("Unable to unlink '%s: %s'\n", path.c_str(), strerror(errno)); + } + } + } + closedir(d); +} + int TWPartitionManager::Cancel_Backup() { string Backup_Folder, Backup_Name, Full_Backup_Path; @@ -638,7 +675,7 @@ int TWPartitionManager::Cancel_Backup() { } int TWPartitionManager::Run_Backup(void) { - int check, do_md5, partition_count = 0; + int check, do_md5, partition_count, disable_free_space_check = 0; string Backup_Folder, Backup_Name, Full_Backup_Path, Backup_List, backup_path; unsigned long long total_bytes = 0, file_bytes = 0, img_bytes = 0, free_space = 0, img_bytes_remaining, file_bytes_remaining, subpart_size; unsigned long img_time = 0, file_time = 0; @@ -726,10 +763,14 @@ int TWPartitionManager::Run_Backup(void) { LOGERR("Unable to locate storage device.\n"); return false; } - if (free_space - (32 * 1024 * 1024) < total_bytes) { - // We require an extra 32MB just in case - LOGERR("Not enough free space on storage.\n"); - return false; + + DataManager::GetValue("tw_disable_free_space", disable_free_space_check); + if (!disable_free_space_check) { + if (free_space - (32 * 1024 * 1024) < total_bytes) { + // We require an extra 32MB just in case + LOGERR("Not enough free space on storage.\n"); + return false; + } } img_bytes_remaining = img_bytes; file_bytes_remaining = file_bytes; diff --git a/partitions.hpp b/partitions.hpp index 3cbd8c3b5..f74fac9a1 100644 --- a/partitions.hpp +++ b/partitions.hpp @@ -213,7 +213,7 @@ public: int Partition_SDCard(void); // Repartitions the sdcard TWPartition *Get_Default_Storage_Partition(); // Returns a pointer to a default storage partition int Cancel_Backup(); // Signals partition backup to cancel - + void Clean_Backup_Folder(string Backup_Folder); // Clean Backup Folder on Error int Fix_Permissions(); void Get_Partition_List(string ListType, std::vector<PartitionList> *Partition_List); int Fstab_Processed(); // Indicates if the fstab has been processed or not |