From 436c6d74bb8e960513e8589f3a2e00341519b13b Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 9 Jan 2018 12:07:47 +0100 Subject: [PATCH 1/4] [fix] Add ability to symlink the archives dir --- src/yunohost/backup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index def7fb27b..4700c63d3 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -2300,7 +2300,7 @@ def backup_delete(name): def _create_archive_dir(): """ Create the YunoHost archives directory if doesn't exist """ - if not os.path.isdir(ARCHIVES_PATH): + if not os.path.isdir(ARCHIVES_PATH) and not os.path.islink(ARCHIVES_PATH): os.mkdir(ARCHIVES_PATH, 0750) From 8d2848a4264412600731fce371532d6f7007392b Mon Sep 17 00:00:00 2001 From: ljf Date: Tue, 9 Jan 2018 13:00:40 +0100 Subject: [PATCH 2/4] [enh] Warn users their symlink archives directory is broken --- locales/en.json | 1 + src/yunohost/backup.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index 0aa8798fd..e59b71621 100644 --- a/locales/en.json +++ b/locales/en.json @@ -101,6 +101,7 @@ "backup_output_directory_forbidden": "Forbidden output directory. Backups can't be created in /bin, /boot, /dev, /etc, /lib, /root, /run, /sbin, /sys, /usr, /var or /home/yunohost.backup/archives sub-folders", "backup_output_directory_not_empty": "The output directory is not empty", "backup_output_directory_required": "You must provide an output directory for the backup", + "backup_output_symlink_dir_broken": "You have a broken symlink instead of your archives directory '{path:s}', may be you have a specific setup, to backup your data on an other filesystem, in this case you probably miss to remount or plug your hard dirve or usb key.", "backup_running_app_script": "Running backup script of app '{app:s}'...", "backup_running_hooks": "Running backup hooks...", "backup_system_part_failed": "Unable to backup the '{part:s}' system part", diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 4700c63d3..0c957db7e 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -2300,7 +2300,12 @@ def backup_delete(name): def _create_archive_dir(): """ Create the YunoHost archives directory if doesn't exist """ - if not os.path.isdir(ARCHIVES_PATH) and not os.path.islink(ARCHIVES_PATH): + if not os.path.isdir(ARCHIVES_PATH): + if os.path.lexists(ARCHIVES_PATH): + raise MoulinetteError(errno.EINVAL, + m18n.n('backup_output_symlink_dir_broken', + path=ARCHIVES_PATH)) + os.mkdir(ARCHIVES_PATH, 0750) From efb841683946270e56e85f2f1bbf1fecbd410db5 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 9 Jan 2018 13:12:46 +0100 Subject: [PATCH 3/4] [fix] English sentences --- locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index e59b71621..5f5eb957f 100644 --- a/locales/en.json +++ b/locales/en.json @@ -101,7 +101,7 @@ "backup_output_directory_forbidden": "Forbidden output directory. Backups can't be created in /bin, /boot, /dev, /etc, /lib, /root, /run, /sbin, /sys, /usr, /var or /home/yunohost.backup/archives sub-folders", "backup_output_directory_not_empty": "The output directory is not empty", "backup_output_directory_required": "You must provide an output directory for the backup", - "backup_output_symlink_dir_broken": "You have a broken symlink instead of your archives directory '{path:s}', may be you have a specific setup, to backup your data on an other filesystem, in this case you probably miss to remount or plug your hard dirve or usb key.", + "backup_output_symlink_dir_broken": "You have a broken symlink instead of your archives directory '{path:s}'. You may have a specific setup to backup your data on an other filesystem, in this case you probably miss to remount or plug your hard dirve or usb key.", "backup_running_app_script": "Running backup script of app '{app:s}'...", "backup_running_hooks": "Running backup hooks...", "backup_system_part_failed": "Unable to backup the '{part:s}' system part", From 27262f0e4bfb6afbed6e54460a236cdd660a846c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 14 Jan 2018 00:30:06 +0100 Subject: [PATCH 4/4] Fix english --- locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index 5f5eb957f..8f83b709c 100644 --- a/locales/en.json +++ b/locales/en.json @@ -101,7 +101,7 @@ "backup_output_directory_forbidden": "Forbidden output directory. Backups can't be created in /bin, /boot, /dev, /etc, /lib, /root, /run, /sbin, /sys, /usr, /var or /home/yunohost.backup/archives sub-folders", "backup_output_directory_not_empty": "The output directory is not empty", "backup_output_directory_required": "You must provide an output directory for the backup", - "backup_output_symlink_dir_broken": "You have a broken symlink instead of your archives directory '{path:s}'. You may have a specific setup to backup your data on an other filesystem, in this case you probably miss to remount or plug your hard dirve or usb key.", + "backup_output_symlink_dir_broken": "You have a broken symlink instead of your archives directory '{path:s}'. You may have a specific setup to backup your data on an other filesystem, in this case you probably forgot to remount or plug your hard dirve or usb key.", "backup_running_app_script": "Running backup script of app '{app:s}'...", "backup_running_hooks": "Running backup hooks...", "backup_system_part_failed": "Unable to backup the '{part:s}' system part",