dar-backup 0.6.5__py3-none-any.whl → 0.6.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dar_backup/__about__.py +1 -1
- dar_backup/dar_backup.py +19 -9
- dar_backup/manager.py +1 -0
- {dar_backup-0.6.5.dist-info → dar_backup-0.6.6.dist-info}/METADATA +16 -5
- dar_backup-0.6.6.dist-info/RECORD +13 -0
- dar_backup-0.6.5.dist-info/RECORD +0 -13
- {dar_backup-0.6.5.dist-info → dar_backup-0.6.6.dist-info}/WHEEL +0 -0
- {dar_backup-0.6.5.dist-info → dar_backup-0.6.6.dist-info}/entry_points.txt +0 -0
- {dar_backup-0.6.5.dist-info → dar_backup-0.6.6.dist-info}/licenses/LICENSE +0 -0
dar_backup/__about__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.6.
|
|
1
|
+
__version__ = "0.6.6"
|
dar_backup/dar_backup.py
CHANGED
|
@@ -30,7 +30,7 @@ from dar_backup.util import RestoreError
|
|
|
30
30
|
|
|
31
31
|
logger = None
|
|
32
32
|
|
|
33
|
-
def generic_backup(type: str, command: List[str], backup_file: str, backup_definition: str, darrc: str, config_settings: ConfigSettings):
|
|
33
|
+
def generic_backup(type: str, command: List[str], backup_file: str, backup_definition: str, darrc: str, config_settings: ConfigSettings, args: argparse.Namespace):
|
|
34
34
|
"""
|
|
35
35
|
Performs a backup using the 'dar' command.
|
|
36
36
|
|
|
@@ -64,6 +64,15 @@ def generic_backup(type: str, command: List[str], backup_file: str, backup_defin
|
|
|
64
64
|
logger.warning("Backup completed with some files not backed up, this can happen if files are changed/deleted during the backup.")
|
|
65
65
|
else:
|
|
66
66
|
raise Exception(str(process))
|
|
67
|
+
|
|
68
|
+
if process.returncode == 0 or process.returncode == 5:
|
|
69
|
+
add_catalog_command = ['manager', '--add-specific-archive' ,backup_file, '--config-file', args.config_file, '--log-level', "debug", "--log-stdout"]
|
|
70
|
+
command_result = run_command(add_catalog_command, config_settings.command_timeout_secs)
|
|
71
|
+
if command_result.returncode == 0:
|
|
72
|
+
logger.info(f"Catalog for archive '{backup_file}' added successfully to its manager.")
|
|
73
|
+
else:
|
|
74
|
+
logger.error(f"Catalog for archive '{backup_file}' not added.")
|
|
75
|
+
|
|
67
76
|
except subprocess.CalledProcessError as e:
|
|
68
77
|
logger.error(f"Backup command failed: {e}")
|
|
69
78
|
raise BackupError(f"Backup command failed: {e}") from e
|
|
@@ -409,19 +418,22 @@ def perform_backup(args: argparse.Namespace, config_settings: ConfigSettings, ba
|
|
|
409
418
|
command = create_backup_command(backup_type, backup_file, args.darrc, backup_definition_path, latest_base_backup)
|
|
410
419
|
|
|
411
420
|
# Perform backup
|
|
412
|
-
generic_backup(backup_type, command, backup_file, backup_definition_path, args.darrc, config_settings)
|
|
421
|
+
generic_backup(backup_type, command, backup_file, backup_definition_path, args.darrc, config_settings, args)
|
|
413
422
|
|
|
414
423
|
logger.info("Starting verification...")
|
|
415
|
-
|
|
416
|
-
if
|
|
424
|
+
verify_result = verify(args, backup_file, backup_definition_path, config_settings)
|
|
425
|
+
if verify_result:
|
|
417
426
|
logger.info("Verification completed successfully.")
|
|
418
427
|
else:
|
|
419
428
|
logger.error("Verification failed.")
|
|
420
429
|
|
|
421
|
-
|
|
430
|
+
|
|
431
|
+
if verify_result and config_settings.par2_enabled:
|
|
422
432
|
logger.info("Generate par2 redundancy files.")
|
|
423
433
|
generate_par2_files(backup_file, config_settings, args)
|
|
424
434
|
logger.info("par2 files completed successfully.")
|
|
435
|
+
|
|
436
|
+
|
|
425
437
|
except Exception as e:
|
|
426
438
|
logger.exception(f"Error during {backup_type} backup process, continuing to next backup definition.")
|
|
427
439
|
|
|
@@ -461,16 +473,14 @@ def generate_par2_files(backup_file: str, config_settings: ConfigSettings, args)
|
|
|
461
473
|
for slice_file in dar_slices:
|
|
462
474
|
file_path = os.path.join(config_settings.backup_dir, slice_file)
|
|
463
475
|
|
|
464
|
-
|
|
465
|
-
logger.info(f"{counter}/{number_of_slices}: Now generating par2 files for {file_path}")
|
|
476
|
+
logger.info(f"{counter}/{number_of_slices}: Now generating par2 files for {file_path}")
|
|
466
477
|
|
|
467
478
|
# Run the par2 command to generate redundancy files with error correction
|
|
468
479
|
command = ['par2', 'create', f'-r{config_settings.error_correction_percent}', '-q', '-q', file_path]
|
|
469
480
|
process = run_command(command, config_settings.command_timeout_secs)
|
|
470
481
|
|
|
471
482
|
if process.returncode == 0:
|
|
472
|
-
|
|
473
|
-
logger.info(f"{counter}/{number_of_slices}: Done")
|
|
483
|
+
logger.info(f"{counter}/{number_of_slices}: Done")
|
|
474
484
|
else:
|
|
475
485
|
logger.error(f"Error generating par2 files for {file_path}")
|
|
476
486
|
raise subprocess.CalledProcessError(process.returncode, command)
|
dar_backup/manager.py
CHANGED
|
@@ -60,6 +60,7 @@ def create_db(backup_def: str, config_settings: ConfigSettings):
|
|
|
60
60
|
|
|
61
61
|
if os.path.exists(database_path):
|
|
62
62
|
logger.warning(f'"{database_path}" already exists, skipping creation')
|
|
63
|
+
return 0
|
|
63
64
|
else:
|
|
64
65
|
logger.info(f'Create catalog database: "{database_path}"')
|
|
65
66
|
command = ['dar_manager', '--create' , database_path]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dar-backup
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.6
|
|
4
4
|
Summary: A script to do full, differential and incremental backups using dar. Some files are restored from the backups during verification, after which par2 redundancy files are created. The script also has a cleanup feature to remove old backups and par2 files.
|
|
5
|
-
Project-URL: Homepage, https://github.com/per2jensen/dar-backup
|
|
5
|
+
Project-URL: Homepage, https://github.com/per2jensen/dar-backup/tree/main/v2
|
|
6
6
|
Project-URL: Changelog, https://github.com/per2jensen/dar-backup/blob/main/v2/Changelog.md
|
|
7
7
|
Project-URL: Issues, https://github.com/per2jensen/dar-backup/issues
|
|
8
8
|
Author-email: dar-backup <per2jensen@gmail.com>
|
|
@@ -845,6 +845,7 @@ Example of backup definition for a home directory
|
|
|
845
845
|
Installation is currently in a venv. These commands are installed in the venv:
|
|
846
846
|
- dar-back
|
|
847
847
|
- cleanup
|
|
848
|
+
- manager
|
|
848
849
|
|
|
849
850
|
To install, create a venv and run pip:
|
|
850
851
|
````
|
|
@@ -911,22 +912,32 @@ options:
|
|
|
911
912
|
--log-stdout also print log messages to stdout
|
|
912
913
|
--do-not-compare do not compare restores to file system
|
|
913
914
|
-v, --version Show version and license information.
|
|
914
|
-
|
|
915
915
|
````
|
|
916
916
|
|
|
917
917
|
## 4
|
|
918
|
+
Generate the archive catalog database(s).
|
|
919
|
+
`dar-backup` expects the catalog databases to be in place, it does not automatically create them (by design)
|
|
920
|
+
|
|
921
|
+
````
|
|
922
|
+
manager --create-db --config-file <path to config file> --log-level debug --log-stdout
|
|
923
|
+
````
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
## 5
|
|
918
929
|
You are ready to do backups of all your backup definitions, if your backup definitions are
|
|
919
930
|
in place in BACKUP.D_DIR (see config file)
|
|
920
931
|
````
|
|
921
932
|
dar-backup --full-backup
|
|
922
933
|
````
|
|
923
934
|
|
|
924
|
-
or a backup of a single definition
|
|
935
|
+
or a backup of a single definition. The definition's name is the filename of the definition in the `backup.d` config directory.
|
|
925
936
|
````
|
|
926
937
|
dar-backup --full-backup -d <your backup definition>
|
|
927
938
|
````
|
|
928
939
|
|
|
929
|
-
##
|
|
940
|
+
## 6
|
|
930
941
|
|
|
931
942
|
Deactivate the virtual environment
|
|
932
943
|
````
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
dar_backup/.darrc,sha256=3d9opAnnZGU9XLyQpTDsLtgo6hqsvZ3JU-yMLz-7_f0,2110
|
|
2
|
+
dar_backup/__about__.py,sha256=GTf8rijLTDSqTWQgxKQN312t-j2E-t3ioZB4U22DXxc,21
|
|
3
|
+
dar_backup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
dar_backup/cleanup.py,sha256=DgmxSUwKrLLIQuYSIY_yTRhIuOMgI6ivjlQuH4u3wX4,9057
|
|
5
|
+
dar_backup/config_settings.py,sha256=CBMUhLOOZ-x7CRdS3vBDk4TYaGqC4N1Ot8IMH-qPaI0,3617
|
|
6
|
+
dar_backup/dar_backup.py,sha256=oUlGCLeYwkJKSqn1qzKqkhpoQVTp-fCWyJcpmkSnLjc,32703
|
|
7
|
+
dar_backup/manager.py,sha256=7bo64O4Pk5mLBp5NaID7YQ9GOuLunl5R42z_SUORW-Q,19215
|
|
8
|
+
dar_backup/util.py,sha256=SSSJYM9lQZfubhTUBlX1xDGWmCpYEF3ePARmlY544xM,11283
|
|
9
|
+
dar_backup-0.6.6.dist-info/METADATA,sha256=NklByKxLaD_ATU-XniHmM_EaOiBc5Gen93QkqVO2jfY,64184
|
|
10
|
+
dar_backup-0.6.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
11
|
+
dar_backup-0.6.6.dist-info/entry_points.txt,sha256=x9vnW-JEl8mpDJC69f_XBcn0mBSkV1U0cyvFV-NAP1g,126
|
|
12
|
+
dar_backup-0.6.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
13
|
+
dar_backup-0.6.6.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
dar_backup/.darrc,sha256=3d9opAnnZGU9XLyQpTDsLtgo6hqsvZ3JU-yMLz-7_f0,2110
|
|
2
|
-
dar_backup/__about__.py,sha256=_f8whmZJ36ZCTk0Zldzy3KONxDBm0bxyKt7pCSHC3cE,21
|
|
3
|
-
dar_backup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
dar_backup/cleanup.py,sha256=DgmxSUwKrLLIQuYSIY_yTRhIuOMgI6ivjlQuH4u3wX4,9057
|
|
5
|
-
dar_backup/config_settings.py,sha256=CBMUhLOOZ-x7CRdS3vBDk4TYaGqC4N1Ot8IMH-qPaI0,3617
|
|
6
|
-
dar_backup/dar_backup.py,sha256=YZoVu9NJX3_WIkQIG8EMLSK3-VWdslI0c2XKrM2Un38,32214
|
|
7
|
-
dar_backup/manager.py,sha256=2qTcn1HiDrejc6S7dLpkylURGzMQ0QqTaSl2KQQ58Uw,19198
|
|
8
|
-
dar_backup/util.py,sha256=SSSJYM9lQZfubhTUBlX1xDGWmCpYEF3ePARmlY544xM,11283
|
|
9
|
-
dar_backup-0.6.5.dist-info/METADATA,sha256=z0xQGBCg2sGMi93gtNCK0DXINE1ZgsohQbQh0zutlD4,63802
|
|
10
|
-
dar_backup-0.6.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
11
|
-
dar_backup-0.6.5.dist-info/entry_points.txt,sha256=x9vnW-JEl8mpDJC69f_XBcn0mBSkV1U0cyvFV-NAP1g,126
|
|
12
|
-
dar_backup-0.6.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
13
|
-
dar_backup-0.6.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|