start introducing modules

This commit is contained in:
timeshifter
2022-12-06 14:59:55 +01:00
parent 80cfe58be1
commit 695c4fc924
17 changed files with 949 additions and 857 deletions
Executable
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import annotations
from sys import exit
import config
from zfs_backup.misc import verify_running_as_root
from zfs_backup import Manager, Pool, ExternalPool
EXIT_ERROR = 1
def main():
verify_running_as_root()
local_pool = Pool(config.local_pool_to_backup)
external_pool = ExternalPool.find_from_dict(config.backup_pools)
manager = Manager(local_pool, external_pool)
manager.backup()
# TODO tests
# TODO --skip-import
# TODO skip post-backup scrub if nothing was sent (except when pre-scrub was also skipped)
# TODO print time estimation while scrub is in progress
# TODO logging
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
exit(EXIT_ERROR)
except Exception as e:
print(e)
exit(EXIT_ERROR)