-
Notifications
You must be signed in to change notification settings - Fork 282
Add backup / restore admin commands #747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
4bf61d4
3008e03
336e515
fb48fc2
2d88d8e
ec13bd3
5ee0264
7422d9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -59,7 +59,7 @@ | |||||
| have_powermon = False | ||||||
| powermon_exception = e | ||||||
| meter = None | ||||||
| from meshtastic.protobuf import channel_pb2, config_pb2, portnums_pb2 | ||||||
| from meshtastic.protobuf import admin_pb2, channel_pb2, config_pb2, portnums_pb2 | ||||||
| from meshtastic.version import get_active_version | ||||||
|
|
||||||
| def onReceive(packet, interface) -> None: | ||||||
|
|
@@ -462,6 +462,22 @@ def onConnected(interface): | |||||
| waitForAckNak = True | ||||||
| interface.getNode(args.dest, False, **getNode_kwargs).removeFavorite(args.remove_favorite_node) | ||||||
|
|
||||||
| if args.backup_prefs: | ||||||
| closeNow = True | ||||||
| waitForAckNak = True | ||||||
| print(f"Backing up preferences to {args.backup_prefs}") | ||||||
| interface.getNode(args.dest, False, **getNode_kwargs).backupPreferences(args.backup_prefs) | ||||||
|
|
||||||
| if args.restore_prefs: | ||||||
| closeNow = True | ||||||
| waitForAckNak = True | ||||||
| interface.getNode(args.dest, False, **getNode_kwargs).restorePreferences(args.restore_prefs) | ||||||
|
|
||||||
| if args.remove_backup_prefs: | ||||||
| closeNow = True | ||||||
| waitForAckNak = True | ||||||
| interface.getNode(args.dest, False, **getNode_kwargs).removePreferencesBackups(args.remove_backup_prefs) | ||||||
|
|
||||||
| if args.set_ignored_node: | ||||||
| closeNow = True | ||||||
| waitForAckNak = True | ||||||
|
|
@@ -1794,12 +1810,40 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars | |||||
| action="store_true", | ||||||
| ) | ||||||
|
|
||||||
| group.add_argument( | ||||||
| "--backup-prefs", | ||||||
| help="Tell the destination node to create a backup preferences file." | ||||||
| "Location: 0 for local flash, 1 for SD card.", | ||||||
| default=admin_pb2.AdminMessage.BackupLocation.FLASH, | ||||||
| nargs="?", | ||||||
| const=0, | ||||||
|
Comment on lines
+1817
to
+1819
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You probably want |
||||||
| ) | ||||||
|
|
||||||
| group.add_argument( | ||||||
| "--restore-prefs", | ||||||
| help="Tell the destination node to remove backup preferences files." | ||||||
|
||||||
| help="Tell the destination node to remove backup preferences files." | |
| help="Tell the destination node to restore preferences from a backup." |
Copilot uses AI. Check for mistakes.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [tool.poetry] | ||
| name = "meshtastic" | ||
| version = "2.5.12" | ||
| version = "2.6.0a1" | ||
| description = "Python API & client shell for talking to Meshtastic devices" | ||
| authors = ["Meshtastic Developers <[email protected]>"] | ||
| license = "GPL-3.0-only" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be nice if we allow people to pass
FLASHandSDhere. I think we could do that by trying to parse as an int, and if it fails, throw it at something likeadmin_pb2.AdminMessage.BackupLocation.__getattr__('FLASH')to convert.I think this could be done by adding a helper function and passing it as
typeto these add_argument calls:I'm a bit tired so hopefully I'm relaying this properly, heh.