2013-06-27 20:03:07 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2013-07-06 09:42:26 +02:00
|
|
|
""" License
|
|
|
|
|
|
|
|
Copyright (C) 2013 YunoHost
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program; if not, see http://www.gnu.org/licenses
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
""" yunohost_backup.py
|
2013-07-06 10:17:16 +02:00
|
|
|
|
|
|
|
Manage backups
|
2013-07-06 09:42:26 +02:00
|
|
|
"""
|
2013-06-27 20:03:07 +02:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import json
|
|
|
|
import yaml
|
|
|
|
import glob
|
2014-02-05 02:01:03 +01:00
|
|
|
|
|
|
|
from ..core.helpers import YunoHostError, YunoHostLDAP, validate, colorize, win_msg
|
2013-06-27 20:03:07 +02:00
|
|
|
|
|
|
|
def backup_init(helper=False):
|
|
|
|
"""
|
|
|
|
Init Tahoe-LAFS configuration
|
|
|
|
|
2013-07-06 10:17:16 +02:00
|
|
|
Keyword argument:
|
|
|
|
helper -- Init as a helper node rather than a "helped" one
|
2013-06-27 20:03:07 +02:00
|
|
|
|
|
|
|
"""
|
2013-08-05 09:31:13 +02:00
|
|
|
tahoe_cfg_dir = '/usr/share/yunohost/yunohost-config/backup'
|
|
|
|
if helper:
|
|
|
|
configure_cmd = '/configure_tahoe.sh helper'
|
|
|
|
else:
|
|
|
|
configure_cmd = '/configure_tahoe.sh'
|
|
|
|
|
|
|
|
os.system('tahoe create-client /home/yunohost.backup/tahoe')
|
|
|
|
os.system('/bin/bash '+ tahoe_cfg_dir + configure_cmd)
|
|
|
|
os.system('cp '+ tahoe_cfg_dir +'/tahoe.cfg /home/yunohost.backup/tahoe/')
|
2013-11-19 10:56:09 +01:00
|
|
|
try:
|
|
|
|
with open('/etc/yunohost/light') as f: pass
|
|
|
|
except IOError:
|
2013-11-21 19:08:53 +01:00
|
|
|
pass
|
|
|
|
#os.system('update-rc.d tahoe-lafs defaults')
|
|
|
|
#os.system('service tahoe-lafs restart')
|