summaryrefslogtreecommitdiffstats
path: root/twrpTar.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ADB Backup: Fix gzip backup and restorebigbiff bigbiff2017-11-271-1/+1
| | | | Change-Id: I92821c7053089d130a5ab73fa36aec486da77bf1
* twrpTar: Fix uninitialized current_archive_typenkk712017-07-211-0/+1
| | | | | | | * current_archive_type is not properly initialized leading to a potential random close(fd) in closeTar() Change-Id: I1598ba4d524b723b8175ee847e2b1c5aeedbd938
* ADB Backup: fix adb restore issuesbigbiff bigbiff2017-04-231-1/+1
| | | | | | | | | | | Set Backup_FileName on adb backup to fix restore. Set read_from_adb after EOF to return properly from newer adb client prompt. Create setter and getter for Backup_FileName for openrecoveryscript.cpp which is not a friend class. Fix condition for twrpTar::Get_Size() and adb backup. Change-Id: I7eb8168fa3416366b996e220cecbc0e1bcec5e8e
* libtar: support backing up and restoring new Android user.* xattrEthan Yonker2017-02-171-2/+2
| | | | | | | Support for backing up and restoring user.default, user.inode_cache, and user.inode_code_cache xattrs introduced in Android 7.x Change-Id: I6e0aa7fc9cd30ed004ef28ebb58d60a82e518123
* Improve backup display names with emulated storageEthan Yonker2017-02-081-1/+0
| | | | | | | | | | | | | -Change backup display name to say that we are excluding storage -Add warning message during backup of any partition with data media -Also eliminate unused variable from twrpTar class Maybe this will make the people in issue 276 happy, but probably not because they already lost their data, or because the warning text is yellow instead of red. https://github.com/TeamWin/Team-Win-Recovery-Project/issues/276 Change-Id: I98303fe7f6b7a25fea029637c90145258d41ee46
* Unused variable cleanupMatt Mower2017-01-181-7/+3
| | | | Change-Id: I2397d0bd221dcf5c9d0f971ba157519bcf014a70
* Whitespace cleanupMatt Mower2017-01-181-7/+7
| | | | Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
* libtar: backup and restore posix capabilitiesEthan Yonker2017-01-181-2/+2
| | | | | | | This patch also allows libtar to combine data from multiple extended tar headers into a single header. Change-Id: I82d13e89a3622ea665b60062b1904ddbedfa41b3
* Support backup/restore of FBE policiesEthan Yonker2016-12-131-12/+22
| | | | Change-Id: Iba8ef20f57b0fb57bb9406c53148a806441d0b59
* Improve backup & wipe exclusion handlingEthan Yonker2016-11-301-5/+16
| | | | | | | | | | | | | | Rename twrpDU.* to exclude.* Remove global variable for du and replace with partition specific variables. Use separate exclusion lists for backups and wiping. Clean up some includes Fix some parenthesis in twrp.cpp that I messed up. Note: twrpTarMain command line utility compiles but probably does not work correctly yet due to not properly setting part_settings Change-Id: Idec9c3e6a8782ba53f3420fa79ba33394f4f85fb
* Fix image flashing: attempt 2James Christopher Adduono2016-11-301-1/+1
| | | | | | | We missed a spot! Change-Id: Ic838f4a23107b4d52d3fb1d7a875e265726c4516 (cherry picked from commit e9a3ee2693df3b9ebe7f501bc93411065559b5f1)
* Fix compressed backups with split archivesEthan Yonker2016-09-121-27/+40
| | | | Change-Id: I8b9197a18cd83c304e5d4ed29ef55ba67e4e42f7
* Make it backwards compatible with 4.4Ethan Yonker2016-08-251-9/+9
| | | | Change-Id: I668604cddc8e8afbf78709f3f872bea4e9f4aa06
* ADB: Add adb backup for TWRP.bigbiff2016-08-011-108/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Functionality for client side to backup tar and image streams over adbd to the client under backup.ab. Using adb backup on the client side you can backup the partitions TWRP knows about. On the client side you can do the following: adb backup -f <filename> --twrp <options> where options are --compress: compress data system: backup system cache: backup cache data: backup data boot: backup boot etc for each partition. You can string multiple options, i.e. adb backup -f <filename> --twrp --compress cache system data adb backup in TWRP will take any option corresponding to TWRP fstab partitions, e.g. efs boot as well. If you do not specify the filename with the -f option, adb will backup your data to a filename backup.ab on the client. You can then rename the file and encrypt it with desktop tools. If you don't want to use command line arguments: adb backup --twrp will bring up the gui and allow you to choose partitions from the backup page. To restore the backup use the following convention: adb restore <filename> Structures are used to store metadata in binary inside of the file itself. If the metadata structure is modified, update the adb version so that it will invalidate older backups and not cause issues on restore. When restoring, we currently do not support picking specific partitions. It's all or nothing. Change-Id: Idb92c37fc9801dc8d89ed2a4570e9d12e76facf8
* Improve progress bar handling for backup / restore / image flashEthan Yonker2016-03-311-47/+36
| | | | | | | | | | | | | | | | | The progress bar will now be updated during image backups, restores and during image flashing (except for sparse images which will require significant changes to libsparse, and except for mtd nand using flash_utils). The progress bar will now be updated mid-file for file systems (tar) so the user will see changes even during large file backup / restore. Add a new progress tracking class to simplify handling of progress bar updates. The class will only update the progress bar 5 times a second to reduce the CPU load from updating the GUI frequently which does affect backup times. Change-Id: Iff382faef3df1f86604af336c1a8ce8993cd12c5
* Fix a bunch of messagesMatt Mower2016-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Find and rename/remove duplicate string variable names * Add missing string variables to en language file * Fix display of some strings missing @ in front of variable name * Fix several %s --> {1} * Be consistent in usage of cancelled vs. canceled (both spellings acceptable) Tip for finding strings missing from language files: 1) Find all messages: egrep -hr "gui_msg.+=" > /tmp/msgs.txt 2) Regex replace to trim them down WHAT: ^\s+gui_msg(?:[^"]+)"([a-zA-Z0-9_]+)=([^"]+).+ WITH: $1 Note that $2 can be used to retain the message 3) Find missing strings: for i in $(cat /tmp/msgs.txt); do if ! grep -q $i gui/theme/common/languages/en.xml; then echo $i; fi done Change-Id: Ic193162e4b5468bf027472928a370be39840ea1d
* Multiple Language SupportEthan Yonker2015-12-191-86/+155
| | | | | | | | | | | | | | | | | | | | | | | This is similar to https://gerrit.omnirom.org/#/c/14014 A lot of the features built in the older patch set have been split out into separate patches, most of which have already been merged. The remaining functionality here should all be directly related to language selection and loading. We always load English as a base before loading other languages over the top of the base. The idea is that if another language is missing a translation, then we will still display the English. Maybe still to do: read the /cache/recovery/last_locale file and load a language based on that. For me, this file contains just: en_US We probably won't bother with region specific translations so we would have to look at either trimming off the _US or using some other method like perhaps a symlink or a combination of the two. Thanks to _that for twmsg.cpp class Change-Id: I9647a22e47883a3ddd2de1da51f64aab7c328f74
* Merge up to AOSP marshmallow-releaseEthan Yonker2015-10-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to maintain compatibility with older trees, we now have minadbd.old and minui.old. I had to use a TARGET_GLOBAL_CFLAG to handle ifdef issues in minui/minui.d because healthd includes minui/minui.h and there was no other alternative to make minui.h compatible with older trees without having to modify healthd rules which is outside of TWRP. Note that the new minui does not currently have support for qcom overlay graphics. Support for this graphics mode will likely be added in a later patch set. If you are building in a 6.0 tree and have a device that needs qcom overlay graphics, be warned, as off mode charging may not work properly. A dead battery in this case could potentially brick your device if it is unable to charge as healthd handles charging duties. Update rules for building toolbox and add rules for making toybox Use permissive.sh in init.rc which will follow symlinks so we do not have to worry about what binary is supplying the setenforce functionality (toolbox, toybox, or busybox). Fix a few warnings in the main recovery binary source code. Fix a few includes that were missing that prevented compiling in 6.0 Change-Id: Ia67aa2107d260883da5e365475a19bea538e8b97
* twrpTar: fix segfault after encrypted backupsthat2015-04-031-6/+6
| | | | | | | | | | | also use unsigned int for core_count instead of unsigned long long. I'll change it back when 4-billion-core devices are common. PS2 - cast return value via intptr_t (may be important for 64 bit platforms) - output errors from TWFunc::Wait_For_Child to console Change-Id: I04158daa0b64e44d68e179d626a83d81cf5d49f7
* Address a few compiler warningsMatt Mower2015-03-051-2/+2
| | | | Change-Id: I6e063fba8d58c8c53da6bca6292c84e3392aee50
* Properly initialize Archive_Current_Size to 0 in twrpTarEthan Yonker2015-02-271-0/+1
| | | | Change-Id: I30b67787b1d529d6bdf462c8e0bf2338a9961eff
* Add cancel backup capability.bigbiff2015-01-271-11/+19
| | | | | | | | | | | This will stop the iteration of the partition objects, kill the current twrpTar thread and remove the backup directory. Implement TWAtomicInt class to give us a wrapper that automatically uses mutexes before the read and write to help ensure that the reads and writes will be atomic based on documentation. Change-Id: I645b22bc980a292e9c7202acb24ffd22ebe68c63
* Fix twrpTar buildingEthan Yonker2014-12-221-0/+5
| | | | | | | - ifdef around set_metadata - Set tags as optional Change-Id: I438e370c3bf6b590dc80ba372724c47cead6cbe5
* Attempt to set the proper uid/gid/contexts on new files and dirsEthan Yonker2014-12-121-0/+2
| | | | | | | | | | Files and folders that we create during backups, copy log, or MTP operations often do not have the proper uid/gid/contexts assigned. We will attempt to read the proper contexts from the settings storage path and assign those same contexts to any files or dirs that we create. Change-Id: I769f9479854122b49b499de2175e6e2d026f8afd
* Make TWRP compile for arm64Ethan Yonker2014-11-121-3/+3
| | | | | | | | | | | | | | | | -Remove dosfstools for arm64 until we can make it compile -Fix TW_USE_TOOLBOX flag to work again -Fix symlinking and handling of sh when using mksh -Fix legacy properties to find futex_wake function -Fix libcrecovery to not use bsd_signal anymore -Fix rules for building with regards to libcrecovery -Update toolbox_recovery rules to compile tools in lollipop -Fix a few compile errors specific to arm64 Testers report that TWRP does not boot on Nexus 9 and we fail to get a shell for adb shell. At least it compiles without errors. Change-Id: I286be8628defb60cc527b8a548c0bdfcb0ebb574
* Track backup and restore progressEthan Yonker2014-07-091-17/+298
| | | | | | | | Track backup and restore progress based on the sizes of the files as they are being added to the tar backup file. Update the progress bar based on the sizes of the files. Change-Id: Idf649efa1db3e91830b4b2add86203a3f30042ff
* Simplify twrpTar skip dir checks, DU code cleanupMatt Mower2014-04-151-23/+12
| | | | | | | | | | | | | | | | * Remove unused parent variable from twruDU constructor * Replace manual checks for /data/media with DU's check_skip_dirs() function * Remove check_skip_dirs(A,B) function which duplicates the functionality of check_skip_dirs(A) * Remove redundant trailing slash removal from check_absolute_skip_dirs(); this function is only accessed through check_skip_dirs() Change-Id: Icfe8d71de36e33db6749fc5896dd3eafbcf7c9a4
* Only split archives when split_archives is setDees Troy2014-04-071-1/+1
| | | | | | | | | | In some cases, statfs used on partitions like /system does not report a size that would trigger a split archive, but using stat on the individual files shows a larger size that statfs that would trigger a split. This patch prevents us from trying to split an archive unless we explicitly decided to split in advance. Change-Id: I67f5cd343f12333e1189100cf0ec1c20c15b7cc2
* Rearrange opening of output and input files for error handlingDees Troy2014-04-071-38/+64
| | | | | | | | If the file could not be opened, the process would log an error to the log file but the GUI would report success. Rearrange the process so that the GUI shows an error. Change-Id: I96af0b934c8f6f463d56656647b16accd1d40654
* Fix backup and restore of encrypted backupsEthan Yonker2014-04-021-0/+2
| | | | | | | | After removing the DataManager code to support twrpTar separate binary we were failing to pass / set the password for the various separate threads used for openaes. Change-Id: Ifff634777fe122e0195d84f67932177ca8879c2f
* Remove deprecated tar exclude functionalityMatt Mower2014-03-311-17/+1
| | | | | | | | | twrpDU::check_skip_dirs() handles skipped folders now. Everywhere twrpTar::setexcl() is being used to exclude files eventually calls createTarFork(), which in turn calls Generate_TarList(), which checks check_skip_dirs(). Change-Id: Ibbc4eb2eb89863ccb2a15f5a3b5092fb10fcbcc0
* Change to lstat so we don't count the target of symbolic links as partbigbiff bigbiff2014-03-171-2/+2
| | | | | | | of the tar archive size. Big thanks to Tassadar for pointing out the fix. Change-Id: I8894ffef54c93939b5b455634169d9c14d8ed7af
* Fix skipping of relative paths and lost+found in twrpDUVojtech Bocek2014-03-131-12/+3
| | | | | Change-Id: Ib79029fd6237502338b041a6bc2f9e539536d6ad Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
* Fix error handling in createListEthan Yonker2014-03-071-1/+1
| | | | Change-Id: I10211f2a20da119ae6a4a1bb2f768a3fa2ab87da
* Remove unused functionsEthan Yonker2014-02-121-32/+0
| | | | Change-Id: I3230412e6aad7aab0f2fd034cc7b289cd4cd6a97
* Move DataManager functions out of twrpTar.cppEthan Yonker2014-02-101-14/+9
| | | | Change-Id: I943318afe787ff4ede724fa0bc77ebc6a3ba0c8b
* Refactor twrpTar to use TarListDees Troy2014-02-031-295/+71
| | | | | | | | Eliminate the use of tarDirs and Generate_MultipleArcives in favor of Generate_TarList so that we have one method for backup creation instead of three. Change-Id: I267937b6e40b32d43fbac8b4cca82f7468d4f94c
* declare dir for non data/media devicesDees Troy2013-12-201-0/+2
| | | | Change-Id: I60e2e2a880c3bd5fff3f485f7c8e4ac9ab6fd3bd
* Create a TWRP Disk Usage Class to retain state about a directory and whether we should skip it in other classes like twrpTar.bigbiff bigbiff2013-12-191-9/+24
| | | | | | Moved Get_Folder_Size to this new class. Change-Id: If0a0220f900eb109581f2eeaf7b76e3f7d6886f1
* fix getting and setting contexts in selinuxbigbiff bigbiff2013-10-171-1/+6
| | | | | | recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
* Ensure root folders get added in split archivesDees Troy2013-10-171-1/+7
| | | | | | | Make sure that we add the root folder itself to get the perms and SELinux contexts before splitting to a second archive. Change-Id: Id93a9f9b4767b61bba38eb0cf7306c81a8540a3c
* libtar: store SELinux file context in tar archivesVojtech Bocek2013-09-051-10/+10
| | | | | | | | | * Using RedHat's "RHT.security.selinux=" tag in extended tar header (type 'x') Signed-off-by: Vojtech Bocek <vbocek@gmail.com> Change-Id: I102e492e4fa5b8a08fae4d34eb36386862509b4d
* skip checking size on linksbigbiff bigbiff2013-08-281-40/+60
| | | | | | skip google music cache Change-Id: I75d6fd0e17140d12cb2c6d335e8ff73a6f871aa2
* ignore lost+found in all the placesbigbiff bigbiff2013-08-281-6/+6
|
* Unify indentation and little clean-up in TWRP filesVojtech Bocek2013-08-241-1/+1
| | | | Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
* Fix problem with not waiting for pigz to exitDees_Troy2013-08-141-1/+1
| | | | | In some cases compressed backups would not wait for pigz to finish leading to backup files that were 0 bytes or MD5 mismatches.
* Fix permissions on backup filesDees_Troy2013-07-241-14/+13
|
* Fix backup of datadataDees_Troy2013-07-011-10/+15
| | | | Change-Id: Ib0098542599283787592ba08caa070dc818d6111
* Support encrypted backup filesDees_Troy2013-06-221-221/+936
| | | | | | | | | | | | | | | Also includes features merged from: Update twrpTar by kokotas Revised function entryExists(). Added function to get archive's uncompressed size. Added option to exclude item(s) from the archive. Revised forks() http://review.teamw.in/#/c/590/ Change-Id: I01fa2c81643161984eff2625247af75990684bd9
* Move all AOSP code out of recovery binaryDees_Troy2013-04-041-51/+51
| | | | | | Improves license compatibility between GPL and Apache Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0
* Add search function to libtarn0d32013-03-181-14/+42
| | | | | | | Function entryExists() can be called in order to check if an entry exists inside an archive. Change-Id: Id3d13d20dfb74a1779dbd8ba6f0ab08c3ca46319
* Fix backup of initial directory with split archivesDees_Troy2013-03-161-22/+23
| | | | Change-Id: Icbb3be817b8a8fe693f6ee015152f780c40b3f7a
* Fix capturing exit status to properly display libtar resultsDees_Troy2013-03-021-2/+2
| | | | | | Error conditions were always showing successful in the TWRP GUI making it much more difficult to determine if a backup or restore was actually successful.
* libtar - Fix extraction of hardlinks to use the prefixDees_Troy2013-02-271-2/+2
| | | | Change-Id: I116982ceed722364406b99fb08bc6943afa0390a
* fix restore on mknodbigbiff bigbiff2013-02-271-2/+6
| | | | Change-Id: I9fb8b927f81a8cded651e42026beb3d5c252d1e8
* using __popen segfaults, switch back to popenbigbiff bigbiff2013-02-221-3/+3
|
* change libtar to fork instead of pthreadbigbiff bigbiff2013-02-181-28/+117
| | | | | | Conflicts: twrpTar.cpp
* This adds a 60 second screen timeout for TWRP. Might consider making this configurable in the future.bigbiff bigbiff2013-02-131-0/+4
| | | | | | | | | | | | | | | Will also set overlay to lockscreen so we don't have inadvetent screen selections. Touching the screen will bring the display back up. add back check script for poweroff move diff time function to twrp-functions.cpp make sure we chmod after copy_file add read_file and write_file functions to twrp-functions.cpp make single thread try to force update screen add forceRender drop caches after tar processing Change-Id: I3c5c509dd39dbb05451bbfe5d8b56d53c90d8d1b
* Change popen in twrpTar to __popenDees_Troy2013-02-121-6/+7
| | | | Change-Id: I921b0647b1f63dd348b059eb630ebe9bf5ec570d
* Add write buffer for tar writesDees_Troy2013-02-071-67/+88
| | | | | | | update fuse to 2.9.2 catch return from unlink so that we don't print error messages when things work Change-Id: I1115039a0fa5d9d73f78ef1abd79755d7ffd9d96
* change tar create to pthreadbigbiff bigbiff2013-01-241-65/+121
| | | | Change-Id: I5a33d207ec6683de20da37e6f4f174c67785fc52
* Add libtar to TWRP instead of using busybox tarbigbiff bigbiff2013-01-091-0/+409
Add proper mkdosfs tool Add fuse to TWRP Add experimental exfat-fuse to TWRP Convert all system() functions to use new Exec_Cmd function