Commit 8c706b8a authored by James Valleroy's avatar James Valleroy

backups: Dump manifests file and include it in backup

Signed-off-by: James Valleroy's avatarJames Valleroy <>
parent e736d471
......@@ -19,6 +19,7 @@ FreedomBox app to manage backup archives.
import json
import os
from django.utils.translation import ugettext_lazy as _
......@@ -37,6 +38,8 @@ description = [_('Backups allows creating and managing backup archives.'), ]
service = None
MANIFESTS_FOLDER = '/var/lib/plinth/backups-manifests/'
def init():
"""Intialize the module."""
......@@ -70,7 +73,16 @@ def get_archive(name):
def _backup_handler(packet):
"""Performs backup operation on packet."""
if not os.path.exists(MANIFESTS_FOLDER):
manifest_path = MANIFESTS_FOLDER + packet.label + '.json'
manifests = {x[0]: x[2] for x in packet.manifests}
with open(manifest_path, 'w') as manifest_file:
json.dump(manifests, manifest_file)
paths = packet.directories + packet.files
['create', '--name', packet.label, '--path'] + paths)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment