Skip to content

Commit b557768

Browse files
committed
Fix gdrivesync.py
1 parent 5a6967e commit b557768

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

pwnagotchi/ai/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def load(config, agent, epoch, from_disk=True):
5959

6060
return a2c
6161
except Exception as e:
62-
logging.exception("[AI] error while starting AI (%s)", e)
62+
logging.info("[AI] Error while starting AI")
63+
logging.debug("[AI] error while starting AI (%s)", e)
6364
logging.info("[AI] Deleting brain and restarting.")
6465
os.system("rm /root/brain.nn && service pwnagotchi restart")
6566

pwnagotchi/plugins/default/gdrivesync.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class 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

Comments
 (0)