diff --git a/yunohost_backup.py b/yunohost_backup.py index 7efa20b6..ecda902a 100644 --- a/yunohost_backup.py +++ b/yunohost_backup.py @@ -38,4 +38,14 @@ def backup_init(helper=False): helper -- Init as a helper node rather than a "helped" one """ - pass + 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/') + os.system('update-rc.d tahoe-lafs defaults') + os.system('service tahoe-lafs restart') diff --git a/yunohost_tools.py b/yunohost_tools.py index 19d54d5d..fd1d53be 100644 --- a/yunohost_tools.py +++ b/yunohost_tools.py @@ -34,6 +34,7 @@ import json from yunohost import YunoHostError, YunoHostLDAP, validate, colorize, get_required_args, win_msg from yunohost_domain import domain_add from yunohost_dyndns import dyndns_subscribe +from yunohost_backup import backup_init def tools_ldapinit(password=None): """ @@ -287,6 +288,9 @@ def tools_postinstall(domain, password, dyndns=False): # Change LDAP admin password tools_adminpw(old_password='yunohost', new_password=password) + # Initialize backup system + backup_init() + os.system('touch /etc/yunohost/installed') os.system('service samba restart')