From 760163f823900bef6ffe3e466395b5b319b98acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 26 Apr 2016 15:30:49 +0200 Subject: [PATCH] [fix] Update arguments passed to the scripts --- scripts/backup | 10 +++++----- scripts/install | 3 ++- scripts/remove | 4 +++- scripts/restore | 8 +++++--- scripts/upgrade | 3 ++- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/scripts/backup b/scripts/backup index f2bc33d..a87d461 100755 --- a/scripts/backup +++ b/scripts/backup @@ -3,12 +3,12 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# The last argument is the app instance name +app=${!#} -# The parameter $1 is the backup directory location -# which will be compressed afterward -backup_dir=$1/apps/$app -sudo mkdir -p $backup_dir +# The first argument is the backup directory location for the app +# from where the script is executed and which will be compressed afterward +backup_dir=$1 # Backup sources & data sudo cp -a /var/www/$app/. $backup_dir/sources diff --git a/scripts/install b/scripts/install index d7f2ae6..3af9c08 100755 --- a/scripts/install +++ b/scripts/install @@ -3,7 +3,8 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# The last argument is the app instance name +app=${!#} # Retrieve arguments domain=$1 diff --git a/scripts/remove b/scripts/remove index 6bf0b02..54028f3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,5 +1,7 @@ #!/bin/bash -app=ynhexample + +# The last argument is the app instance name +app=${!#} # Retrieve arguments domain=$(sudo yunohost app setting $app domain) diff --git a/scripts/restore b/scripts/restore index 1c20f2e..cde2e6b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -3,10 +3,12 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# The last argument is the app instance name +app=${!#} -# The parameter $1 is the uncompressed restore directory location -backup_dir=$1/apps/$app +# The first argument is the backup directory location of the app +# from where the script is executed +backup_dir=$1 # Restore sources & data sudo cp -a $backup_dir/sources/. /var/www/$app diff --git a/scripts/upgrade b/scripts/upgrade index 1d7a349..e285496 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,7 +3,8 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# The last argument is the app instance name +app=${!#} # Retrieve arguments domain=$(sudo yunohost app setting $app domain)