lfs_backup.c 875 B

12345678910111213141516171819202122
  1. #include "lfs_backup.h"
  2. #include <toolbox/tar/tar_archive.h>
  3. #define LFS_BACKUP_DEFAULT_LOCATION "/ext/" LFS_BACKUP_DEFAULT_FILENAME
  4. bool lfs_backup_create(Storage* storage, const char* destination) {
  5. const char* final_destination =
  6. destination && strlen(destination) ? destination : LFS_BACKUP_DEFAULT_LOCATION;
  7. return storage_int_backup(storage, final_destination) == FSE_OK;
  8. }
  9. bool lfs_backup_exists(Storage* storage, const char* source) {
  10. const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION;
  11. FileInfo fi;
  12. return storage_common_stat(storage, final_source, &fi) == FSE_OK;
  13. }
  14. bool lfs_backup_unpack(Storage* storage, const char* source) {
  15. const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION;
  16. return storage_int_restore(storage, final_source) == FSE_OK;
  17. }