From 375f1653c7b23425c0e5f26c88f49b955806d4f9 Mon Sep 17 00:00:00 2001 From: opi Date: Tue, 10 May 2016 15:51:32 +0200 Subject: [PATCH] [fix] Source helpers. --- scripts/backup | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/backup b/scripts/backup index 50269b2..7a956c3 100644 --- a/scripts/backup +++ b/scripts/backup @@ -3,11 +3,20 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -# The parameter $1 is the backup directory location dedicated to the app -backup_dir=$1 +# Source YNH helpers +. /usr/share/yunohost/helpers -# The last parameter is the id of the app instance -app=${!#} +# This is a multi-instance app, meaning it can be installed several times independently +# The id of the app as stated in the manifest is available as $YNH_APP_ID +# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) +# The app instance name is available as $YNH_APP_INSTANCE_NAME +# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample +# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 +# - ynhexample__{N} for the subsequent installations, with N=3,4, ... +# The app instance name is probably what you are interested the most, since this is +# guaranteed to be unique. This is a good unique identifier to define installation path, +# db names, ... +app=$YNH_APP_INSTANCE_NAME domain=$(sudo yunohost app setting $app domain) path=$(sudo yunohost app setting $app path)