From a2155e224b16a16f550fa71cc8c2530107b0a6ae Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Wed, 27 Dec 2017 10:43:23 +0100 Subject: [PATCH] Fix backup and restore scripts --- scripts/backup | 14 +++++++------- scripts/restore | 28 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/backup b/scripts/backup index 4e9d279..503a5b3 100644 --- a/scripts/backup +++ b/scripts/backup @@ -2,13 +2,6 @@ #================================================= # GENERIC START -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -21,6 +14,13 @@ fi source _common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # LOAD SETTINGS #================================================= diff --git a/scripts/restore b/scripts/restore index 962731f..2424b61 100644 --- a/scripts/restore +++ b/scripts/restore @@ -2,13 +2,6 @@ #================================================= # GENERIC START -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -21,6 +14,13 @@ fi source _common.sh source /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # LOAD SETTINGS #================================================= @@ -55,9 +55,15 @@ ynh_install_app_dependencies $pkg_dependencies # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +# Restore configuration files +ynh_restore_file "/opt/netdata/etc/netdata" + +# Restore permissions to app files +chown -R root: "/opt/netdata/etc/netdata" + # Retrieve app.src from archive for ynh_setup_source helper mkdir ../conf -cp opt/netdata/etc/netdata/app.src ../conf +cp /opt/netdata/etc/netdata/app.src ../conf # Download, check integrity, uncompress and patch the source from app.src NETDATA_TMPDIR=$(mktemp -d) @@ -73,12 +79,6 @@ cd $NETDATA_TMPDIR configure_netdata -# Restore configuration files -ynh_restore_file "/opt/netdata/etc/netdata" - -# Restore permissions to app files -chown -R root: "/opt/netdata/etc/netdata" - #================================================= # GENERIC FINALISATION #=================================================