Nathaniel van Diepen 4 роки тому
батько
коміт
f3c712e19f
3 змінених файлів з 22 додано та 1 видалено
  1. 1 1
      LICENSE
  2. 17 0
      backup.py
  3. 4 0
      etc/backup.d/backup.yml

+ 1 - 1
LICENSE

@@ -1,5 +1,5 @@
 MIT License
-Copyright (c) <year> <copyright holders>
+Copyright (c) 2020 Nathaniel van Diepen
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 

+ 17 - 0
backup.py

@@ -0,0 +1,17 @@
+import os
+from glob import glob
+import yaml
+
+with open("etc/backup.d/backup.yml") as f:
+    config = yaml.load(f)
+
+sources = {}
+for source in config['sources']:
+    for path in glob('etc/backup.d/{}/*.yml'.format(source)):
+        with open(path) as f:
+            if source not in sources:
+                sources[source] = {}
+            sources[source][os.path.basename(path)] = yaml.load(f)
+
+config['sources'] = sources
+print(config)

+ 4 - 0
etc/backup.d/backup.yml

@@ -0,0 +1,4 @@
+---
+engine: rdiff-backup
+sources:
+ - sources.d