From a49ccbeaa16c61dd15506464485af204769f2c39 Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sun, 15 Oct 2023 22:19:45 +0200 Subject: [PATCH] v2.4.7 Signed-off-by: Jeroen Oudshoorn --- pwnagotchi/plugins/default/gdrivesync.py | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pwnagotchi/plugins/default/gdrivesync.py b/pwnagotchi/plugins/default/gdrivesync.py index 0a993bdb..6be80972 100644 --- a/pwnagotchi/plugins/default/gdrivesync.py +++ b/pwnagotchi/plugins/default/gdrivesync.py @@ -91,27 +91,27 @@ class GdriveSync(plugins.Plugin): self.upload_to_gdrive(zip_file_path, self.get_folder_id_by_name(self.drive, self.options['backup_folder'])) self.backup = True - # Specify the local backup path - local_backup_path = '/' + # Specify the local backup path + local_backup_path = '/' - # Download the zip archive from Google Drive - zip_file_id = self.get_latest_backup_file_id(self.options['backup_folder']) - if zip_file_id: - zip_file = self.drive.CreateFile({'id': zip_file_id}) - zip_file.GetContentFile(os.path.join(local_backup_path, 'backup.zip')) - logging.info("[gDriveSync] Downloaded backup.zip from Google Drive") + # Download the zip archive from Google Drive + zip_file_id = self.get_latest_backup_file_id(self.options['backup_folder']) + if zip_file_id: + zip_file = self.drive.CreateFile({'id': zip_file_id}) + zip_file.GetContentFile(os.path.join(local_backup_path, 'backup.zip')) + logging.info("[gDriveSync] Downloaded backup.zip from Google Drive") - # Extract the zip archive to the root directory - with zipfile.ZipFile(os.path.join(local_backup_path, 'backup.zip'), 'r') as zip_ref: - zip_ref.extractall('/') + # Extract the zip archive to the root directory + with zipfile.ZipFile(os.path.join(local_backup_path, 'backup.zip'), 'r') as zip_ref: + zip_ref.extractall('/') - self.status.update() - # Reboot so we can start opwngrid with the backup id - pwnagotchi.reboot() + self.status.update() + # Reboot so we can start opwngrid with the backup id + pwnagotchi.reboot() - # all set, gdriveSync is ready to run - self.ready = True - logging.info("[gdrivesync] loaded") + # all set, gdriveSync is ready to run + self.ready = True + logging.info("[gdrivesync] loaded") except Exception as e: logging.error(f"Error: {e}") self.ready = False