diff --git a/backive/config/config.py b/backive/config/config.py new file mode 100644 index 0000000..8fec439 --- /dev/null +++ b/backive/config/config.py @@ -0,0 +1,27 @@ +import os +import pwd +from ruamel.yaml import YAML +import logging + + +class Config: + + def __init__(self): + pass + + def find_config(self): + # who are we? + uid = os.getuid() + # name? + user = pwd.getpwuid(uid).pw_name + try: + if uid == 0: + config_file = "/etc/mbd.yml" + else: + config_file = os.path.join(os.path.expanduser("~"), ".mbd", "mbd.yml") + pass + + with open(config_file, "r") as cfg: + self._config = YAML().load(cfg) + except Exception as e: + logging.error(e) diff --git a/backive/core/backup.py b/backive/core/backup.py new file mode 100644 index 0000000..12c6f54 --- /dev/null +++ b/backive/core/backup.py @@ -0,0 +1,14 @@ +import os + + +class Backup: + + config = {} + + def __init__(self): + pass + + def run(self): + pass + + diff --git a/backive/core/device.py b/backive/core/device.py new file mode 100644 index 0000000..fced780 --- /dev/null +++ b/backive/core/device.py @@ -0,0 +1,15 @@ +import os + + +class Device: + disks_by_uuid = "/dev/disk/by-uuid" + + def __init__(self): + pass + + @classmethod + def get_device_list(cls): + if os.path.exists(cls.disks_by_uuid): + uuids = os.listdir(cls.disks_by_uuid) + return uuids + return []