Fix: Automatisches Erkennen von vollständigen Backups, auch bei Verschlüsselung.
Die Logik zur Erkennung von vollständigen Backups wurde verbessert. Das Programm prüft nun korrekt, ob bereits ein vollständiges Backup vorhanden ist und schlägt in diesem Fall automatisch ein inkrementelles Backup vor. Dies funktioniert jetzt auch für verschlüsselte Backups.
This commit is contained in:
@@ -35,12 +35,24 @@ class Actions:
|
||||
|
||||
full_backup_exists = False
|
||||
if self.app.destination_path and os.path.isdir(self.app.destination_path):
|
||||
system_backups = self.app.backup_manager.list_system_backups(
|
||||
self.app.destination_path)
|
||||
for backup in system_backups:
|
||||
if backup.get('backup_type_base') == 'Full':
|
||||
full_backup_exists = True
|
||||
break
|
||||
pybackup_dir = os.path.join(self.app.destination_path, "pybackup")
|
||||
encrypted_container = os.path.join(pybackup_dir, "pybackup_encrypted.luks")
|
||||
|
||||
if os.path.exists(encrypted_container):
|
||||
# If an encrypted container exists, we check for any directory inside the pybackup folder.
|
||||
# The presence of any item other than the .luks file and its .txt info file suggests a backup has been made.
|
||||
if os.path.isdir(pybackup_dir):
|
||||
for item in os.listdir(pybackup_dir):
|
||||
if not item.endswith(('.luks', '.txt')) and os.path.isdir(os.path.join(pybackup_dir, item)):
|
||||
full_backup_exists = True
|
||||
break
|
||||
else:
|
||||
# For non-encrypted backups, check for a directory that represents a full backup.
|
||||
system_backups = self.app.backup_manager.list_system_backups(pybackup_dir)
|
||||
for backup in system_backups:
|
||||
if backup.get('backup_type_base') == 'Full':
|
||||
full_backup_exists = True
|
||||
break
|
||||
|
||||
if full_backup_exists:
|
||||
self._set_backup_type("incremental")
|
||||
|
||||
Reference in New Issue
Block a user