From 10aaa9009fcd3e2e82362cb1aedfa37cac25c15f Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 8 Dec 2022 23:02:17 -0800 Subject: [PATCH] skeleton --- .gitignore | 5 +++++ resticbackup/__init__.py | 0 resticbackup/cli.py | 34 ++++++++++++++++++++++++++++++++++ setup.py | 20 ++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 .gitignore create mode 100644 resticbackup/__init__.py create mode 100644 resticbackup/cli.py create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..486dc63 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +__pycache__ +resticbackup.egg-info/ +testenv/ +test_data/ diff --git a/resticbackup/__init__.py b/resticbackup/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/resticbackup/cli.py b/resticbackup/cli.py new file mode 100644 index 0000000..46a977d --- /dev/null +++ b/resticbackup/cli.py @@ -0,0 +1,34 @@ + +def load_configs(): + # load configs from /etc/resticbackup.d/ + # we have special handling for /etc/resticbackup.d/main.json + # return (main_config, dict(config_name=>config)) + pass + + +def cmd_backup(args, parser): + config, backup_configs = load_configs() + + try: + backup_config = backup_configs[args.name] + except KeyError: + parser.error("invalid backup name: '{}'".format(args.name)) + + # perform pre-exec + + # perform backup + + # perform post-exec + + +def cmd_restore(args, parser): + pass # TODO + + +def main(): + print("welcome 2 resticbackup") + pass + + +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..3135684 --- /dev/null +++ b/setup.py @@ -0,0 +1,20 @@ +from setuptools import setup + + +__version__ = "0.0.0" + + +setup(name='resticbackup', + version=__version__, + description='Wrapper around restic for automated backups', + url='', + author='dpedu', + author_email='dave@davepedu.com', + packages=['resticbackup'], + install_requires=[], + entry_points={ + "console_scripts": [ + "resticbackup = resticbackup.cli:main", + ] + }, + zip_safe=False)