backups: Create folder if needed during setup

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
James Valleroy authored and Joseph Nuthalapati committed 2018-09-24 19:45:29 +05:30
1 parent 188309fd91
commit 7817111928
1 file changed
+4
+4
View File
@@ -83,6 +83,10 @@ def subcommand_setup(_):
try:
subprocess.run(['borg', 'info', REPOSITORY], check=True)
except:
path = os.path.dirname(REPOSITORY)
if not os.path.exists(path):
os.makedirs(path)
subprocess.run(['borg', 'init', '--encryption', 'none', REPOSITORY])