fix error on close and fix mount encrypt device
This commit is contained in:
@@ -190,15 +190,15 @@ class EncryptionManager:
|
||||
base_dest_path, profile_name)
|
||||
mapper_name = f"pybackup_luks_{username}_{profile_name}"
|
||||
chown_cmd = self._get_chown_command(mount_point, is_system)
|
||||
luks_open_cmd = f'echo -n "$LUKSPASS" | cryptsetup luksOpen "{container_path}" {mapper_name} {key_or_pass_arg}' if password else f'cryptsetup luksOpen "{container_path}" {mapper_name} {key_or_pass_arg}'
|
||||
luks_open_cmd = f'echo -n \"$LUKSPASS\" | cryptsetup luksOpen "{container_path}" {mapper_name} {key_or_pass_arg}' if password else f'cryptsetup luksOpen "{container_path}" {mapper_name} {key_or_pass_arg}'
|
||||
|
||||
resize_script = f"""set -e
|
||||
# Unmount cleanly first
|
||||
umount \"{mount_point}\"
|
||||
umount \"{mount_point}\"
|
||||
cryptsetup luksClose {mapper_name}
|
||||
|
||||
# Resize container file
|
||||
truncate -s {int(new_total_size)} \"{container_path}\"
|
||||
truncate -s {int(new_total_size)} \"{container_path}\"
|
||||
sleep 1
|
||||
|
||||
# Re-open, check, and resize filesystem
|
||||
@@ -271,13 +271,12 @@ mount \"/dev/mapper/{mapper_name}\" \"{mount_point}\"
|
||||
luks_open_cmd = f'echo -n \"$LUKSPASS\" | cryptsetup luksOpen \"{container_path}\" {mapper_name} {key_or_pass_arg}' if password else f'cryptsetup luksOpen \"{container_path}\" {mapper_name} {key_or_pass_arg}'
|
||||
|
||||
script = f"""set -e
|
||||
umount \"{mount_point}\" || true\
|
||||
cryptsetup luksClose {mapper_name} || true\
|
||||
mkdir -p \"{mount_point}\"\
|
||||
umount \"{mount_point}\" || true
|
||||
cryptsetup luksClose {mapper_name} || true
|
||||
mkdir -p \"{mount_point}\"
|
||||
{luks_open_cmd}
|
||||
mount \"/dev/mapper/{mapper_name}\" \"{mount_point}\"\
|
||||
{chown_cmd}
|
||||
"""
|
||||
mount \"/dev/mapper/{mapper_name}\" \"{mount_point}\"
|
||||
{chown_cmd}"""
|
||||
if self._execute_as_root(script, password):
|
||||
self.add_to_lock_file(base_dest_path, profile_name, mapper_name)
|
||||
return True
|
||||
@@ -294,7 +293,7 @@ mount \"/dev/mapper/{mapper_name}\" \"{mount_point}\"
|
||||
f"Unmounting and resetting owner for {base_dest_path}/{profile_name}")
|
||||
mount_point = self.get_mount_point(base_dest_path, profile_name)
|
||||
|
||||
script = f""" chown root:root \"{mount_point}\" || true
|
||||
script = f"""chown root:root \"{mount_point}\" || true
|
||||
umount \"{mount_point}\" || true
|
||||
cryptsetup luksClose {mapper_name} || true
|
||||
"""
|
||||
|
@@ -331,6 +331,8 @@ class MainApplication(tk.Tk):
|
||||
self.restore_size_frame_before.grid_remove()
|
||||
self.restore_size_frame_after.grid_remove()
|
||||
|
||||
self._process_queue_id = None # Initialize the ID for the scheduled queue processing
|
||||
|
||||
self._load_state_and_initialize()
|
||||
self.protocol("WM_DELETE_WINDOW", self.on_closing)
|
||||
|
||||
@@ -579,6 +581,9 @@ class MainApplication(tk.Tk):
|
||||
self.animated_icon.destroy()
|
||||
self.animated_icon = None
|
||||
|
||||
if self._process_queue_id:
|
||||
self.after_cancel(self._process_queue_id)
|
||||
|
||||
app_logger.log(Msg.STR["app_quit"])
|
||||
try:
|
||||
self.destroy()
|
||||
@@ -746,7 +751,7 @@ class MainApplication(tk.Tk):
|
||||
except Empty:
|
||||
pass
|
||||
finally:
|
||||
self.after(100, self._process_queue)
|
||||
self._process_queue_id = self.after(100, self._process_queue)
|
||||
|
||||
def _update_duration(self):
|
||||
if self.backup_is_running and self.start_time:
|
||||
@@ -882,5 +887,3 @@ if __name__ == "__main__":
|
||||
else:
|
||||
app = MainApplication()
|
||||
app.mainloop()
|
||||
app = MainApplication()
|
||||
app.mainloop()
|
||||
|
@@ -145,9 +145,12 @@ class BackupContentFrame(ttk.Frame):
|
||||
|
||||
self.base_backup_path = backup_path
|
||||
|
||||
source_name = self.app.left_canvas_data.get('folder')
|
||||
profile_name = "system" if source_name == "Computer" else source_name
|
||||
|
||||
# Check if the destination is encrypted and trigger mount if necessary
|
||||
is_encrypted = self.backup_manager.encryption_manager.is_encrypted(
|
||||
backup_path)
|
||||
backup_path, profile_name)
|
||||
self.viewing_encrypted = is_encrypted # Set this flag for remembering the view
|
||||
|
||||
pybackup_dir = os.path.join(backup_path, "pybackup")
|
||||
|
Reference in New Issue
Block a user