diff --git a/data/hooks/backup/40-conf_ynh_currenthost b/data/hooks/backup/40-conf_ynh_currenthost index a91a50001..af054cad4 100644 --- a/data/hooks/backup/40-conf_ynh_currenthost +++ b/data/hooks/backup/40-conf_ynh_currenthost @@ -1,7 +1,4 @@ -backup_dir="$1/conf/ynh/" -backup_dir_legacy="$1/yunohost/" +backup_dir="$1/conf/ynh" sudo mkdir -p $backup_dir -sudo mkdir -p $backup_dir_legacy -sudo cp -a /etc/yunohost/current_host $backup_dir -sudo cp -a /etc/yunohost/current_host $backup_dir_legacy +sudo cp -a /etc/yunohost/current_host "${backup_dir}/current_host" diff --git a/data/hooks/restore/40-conf_ynh_currenthost b/data/hooks/restore/40-conf_ynh_currenthost index 8b1378917..a0bdf94d3 100644 --- a/data/hooks/restore/40-conf_ynh_currenthost +++ b/data/hooks/restore/40-conf_ynh_currenthost @@ -1 +1,3 @@ +backup_dir="$1/conf/ynh" +sudo cp -a "${backup_dir}/current_host" /etc/yunohost/current_host diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 94b15ff42..430ecd570 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -375,11 +375,11 @@ def backup_restore(auth, name, hooks=[], ignore_hooks=False, else: # Retrieve the domain from the backup try: - with open("%s/yunohost/current_host" % tmp_dir, 'r') as f: + with open("%s/conf/ynh/current_host" % tmp_dir, 'r') as f: domain = f.readline().rstrip() except IOError: - logger.debug("unable to retrieve domain from " - "'%s/yunohost/current_host'", tmp_dir, exc_info=1) + logger.debug("unable to retrieve current_host from the backup", + exc_info=1) raise MoulinetteError(errno.EIO, m18n.n('backup_invalid_archive')) logger.debug("executing the post-install...")