1414
1515class GdriveSync (plugins .Plugin ):
1616 __author__ = '@jayofelony'
17- __version__ = '1.1 '
17+ __version__ = '1.2 '
1818 __license__ = 'GPL3'
1919 __description__ = 'A plugin to backup various pwnagotchi files and folders to Google Drive. Once every hour from loading plugin.'
2020
@@ -34,7 +34,7 @@ def __init__(self):
3434 '/etc/pwnagotchi'
3535 ]
3636
37- def on_loaded (self , agent ):
37+ def on_loaded (self ):
3838 """
3939 Called when the plugin is loaded
4040 """
@@ -182,15 +182,15 @@ def on_handshake(self, agent):
182182 logging .info ("[gdrivesync] new handshake captured, backing up to gdrive" )
183183 if self .options ['backupfiles' ] is not None :
184184 self .backupfiles = self .backupfiles + self .options ['backupfiles' ]
185- self .backup_files (self .backupfiles , '/backup' )
185+ self .backup_files (self .backupfiles , '/home/pi/ backup' )
186186
187187 # Create a zip archive of the /backup folder
188188 zip_file_path = os .path .join ('/home/pi' , 'backup.zip' )
189189 with zipfile .ZipFile (zip_file_path , 'w' ) as zip_ref :
190- for root , dirs , files in os .walk ('/backup' ):
190+ for root , dirs , files in os .walk ('/home/pi/ backup' ):
191191 for file in files :
192192 file_path = os .path .join (root , file )
193- arcname = os .path .relpath (file_path , '/backup' )
193+ arcname = os .path .relpath (file_path , '/home/pi/ backup' )
194194 zip_ref .write (file_path , arcname = arcname )
195195
196196 # Upload the zip archive to Google Drive
@@ -199,7 +199,7 @@ def on_handshake(self, agent):
199199
200200 # Cleanup the local zip file
201201 os .remove (zip_file_path )
202- os . remove ( " /backup" )
202+ shutil . rmtree ( "/home/pi /backup" )
203203 self .status .update ()
204204 display = agent .view ()
205205 display .update (force = True , new_data = {'Backing up to gdrive ...' })
0 commit comments