From 720d6b8f6dbfaf867fa061906675094537e0e7d0 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sun, 26 Feb 2017 20:32:07 +0100 Subject: [PATCH 1/5] Make Shaarli private by default (was public) --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index babde23..0fb8556 100644 --- a/manifest.json +++ b/manifest.json @@ -38,7 +38,7 @@ "fr": "Est-ce un site Shaarli public ?" }, "choices": ["Yes", "No"], - "default": "Yes" + "default": "No" }, { "name": "title", From ab96da977639e12b72ecd72ab4be97a6a4f0e11d Mon Sep 17 00:00:00 2001 From: Romain Garbage Date: Mon, 27 Feb 2017 02:33:31 +0200 Subject: [PATCH 2/5] Add backup/restore scripts --- scripts/backup | 20 ++++++++++++++++++++ scripts/restore | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 scripts/backup create mode 100644 scripts/restore diff --git a/scripts/backup b/scripts/backup new file mode 100644 index 0000000..8408871 --- /dev/null +++ b/scripts/backup @@ -0,0 +1,20 @@ +#!/bin/bash + +# Exit on command errors and treat unset variables as an error +set -eu + +# See comments in install script +app=$YNH_APP_INSTANCE_NAME + +# Source YunoHost helpers +source /usr/share/yunohost/helpers + +# Backup sources & data +# Note: the last argument is where to save this path, see the restore script. +ynh_backup "/var/www/${app}" "sources" + +# Copy NGINX configuration +domain=$(ynh_app_setting_get "$app" domain) +ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" + + diff --git a/scripts/restore b/scripts/restore new file mode 100644 index 0000000..8c11af6 --- /dev/null +++ b/scripts/restore @@ -0,0 +1,35 @@ +#!/bin/bash + +# Note: each files and directories you've saved using the ynh_backup helper +# will be located in the current directory, regarding the last argument. + +# Exit on command errors and treat unset variables as an error +set -eu + +# See comments in install script +app=$YNH_APP_INSTANCE_NAME + +# Source YunoHost helpers +source /usr/share/yunohost/helpers + +# Retrieve old app settings +domain=$(ynh_app_setting_get "$app" domain) +path_url=$(ynh_app_setting_get "$app" path_url) + +# Check domain/path availability +sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ + || ynh_die "Path not available: ${domain}${path_url}" + +# Restore sources & data +src_path="/var/www/${app}" +sudo cp -a ./sources "$src_path" + +# Restore permissions to app files +# you may need to make some file and/or directory writeable by www-data (nginx user) +sudo chown -R root: "$src_path" + +# Restore NGINX configuration +sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" + +# Restart webserver +sudo service nginx reload From 9f10b80ab70e1b0d9bc4b79776d7faccbd7c303f Mon Sep 17 00:00:00 2001 From: Romain Garbage Date: Mon, 27 Feb 2017 02:36:45 +0200 Subject: [PATCH 3/5] Update README.md to reflect changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e9ac60b..c85c145 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,13 @@ Help for dev/testing hightly appreciated :) ## Current features * Install / remove scripts + * Backup/restore scripts * Adding / removing a link * Upgrade *not tested* ## TODO * Configure Shaarli during installation - * Add backup/restore scripts * Test more the package ## Changelog From 3d4a46cb0e7ebb655af322df5d335a53caa827ac Mon Sep 17 00:00:00 2001 From: Romain Garbage Date: Mon, 27 Feb 2017 18:22:54 +0200 Subject: [PATCH 4/5] Fix variable in restore script --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 8c11af6..d20330d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers # Retrieve old app settings domain=$(ynh_app_setting_get "$app" domain) -path_url=$(ynh_app_setting_get "$app" path_url) +path_url=$(ynh_app_setting_get "$app" path) # Check domain/path availability sudo yunohost app checkurl "${domain}${path_url}" -a "$app" \ From a365f0d14d3ea7838c106fcb002e1efdd3352569 Mon Sep 17 00:00:00 2001 From: Romain Garbage Date: Sat, 4 Mar 2017 05:01:01 +0200 Subject: [PATCH 5/5] Fix permissions in the restore script --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index d20330d..33a9ee1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,7 +26,7 @@ sudo cp -a ./sources "$src_path" # Restore permissions to app files # you may need to make some file and/or directory writeable by www-data (nginx user) -sudo chown -R root: "$src_path" +sudo chown -R www-data:www-data "$src_path" # Restore NGINX configuration sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf"