From b5f6b055e965e89565ed0a3b7efd55a0743639fa Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Tue, 25 May 2021 22:12:17 -0500 Subject: [PATCH] Starting on frontend --- .gitignore | 1 + config.toml.template | 10 ++++++++++ openwrt_backup/__init__.py | 14 ++++++++++++++ openwrt_backup/__main__.py | 4 ++++ openwrt_backup/config.py | 0 openwrt_backup/config.toml | 1 + 6 files changed, 30 insertions(+) create mode 100644 config.toml.template create mode 100644 openwrt_backup/__main__.py create mode 100644 openwrt_backup/config.py create mode 120000 openwrt_backup/config.toml diff --git a/.gitignore b/.gitignore index e834ebe..f6fab97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.dir-locals.el *.egg-info *.pyc +/dist diff --git a/config.toml.template b/config.toml.template new file mode 100644 index 0000000..2e25b69 --- /dev/null +++ b/config.toml.template @@ -0,0 +1,10 @@ +[ssh] +root = ~/.ssh + +[router] +temp = /tmp + +[backup] +path = ~/Documents/router-backup +time_format="%Y-%m-%d_%H-%M-%S" +keep = 5 diff --git a/openwrt_backup/__init__.py b/openwrt_backup/__init__.py index e69de29..ef4598a 100644 --- a/openwrt_backup/__init__.py +++ b/openwrt_backup/__init__.py @@ -0,0 +1,14 @@ +from argparse import ArgumentParser + + +def main(): + parser = ArgumentParser() + parser.add_argument("-d", "--dry", action="store_true", help="Don't do anything") + parser.add_argument("--dump-config", action="store_true", help="Show config") + parser.add_argument( + "-c" "--config", help="config path for backup script", default=None + ) + parser.add_argument( + "name", help="hostname in ssh_config file for openwrt device we need to backup" + ) + args = parser.parse_args() diff --git a/openwrt_backup/__main__.py b/openwrt_backup/__main__.py new file mode 100644 index 0000000..868d99e --- /dev/null +++ b/openwrt_backup/__main__.py @@ -0,0 +1,4 @@ +from . import main + +if __name__ == "__main__": + main() diff --git a/openwrt_backup/config.py b/openwrt_backup/config.py new file mode 100644 index 0000000..e69de29 diff --git a/openwrt_backup/config.toml b/openwrt_backup/config.toml new file mode 120000 index 0000000..99f11df --- /dev/null +++ b/openwrt_backup/config.toml @@ -0,0 +1 @@ +../config.toml.template \ No newline at end of file