From 54e6f06c3a3038c2735188723cac1dfe3a2ae111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sat, 14 May 2016 18:34:34 +0200 Subject: [PATCH] [fix] Retrieve app settings in upgrade script --- scripts/remove | 3 +++ scripts/upgrade | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/remove b/scripts/remove index 4ae87b4..e0dc339 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,5 +1,8 @@ #!/bin/bash +# Treat unset variables as an error +set -u + # 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", ...) diff --git a/scripts/upgrade b/scripts/upgrade index 9056584..3d2eedb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,7 +1,7 @@ #!/bin/bash -# causes the shell to exit if any subcommand or pipeline returns a non-zero status -set -e +# Exit on command errors and treat unset variables as an error +set -eu # 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 @@ -15,12 +15,12 @@ set -e # db names, ... app=$YNH_APP_INSTANCE_NAME -# Retrieve arguments -domain=$YNH_APP_ARG_DOMAIN -path=$YNH_APP_ARG_PATH -admin_user=$YNH_APP_ARG_ADMIN_USER -upload_password=$YNH_APP_ARG_UPLOAD_PASSWORD -is_public=$YNH_APP_ARG_IS_PUBLIC +# Retrieve settings +domain=$(sudo yunohost app setting $app domain) +path=$(sudo yunohost app setting $app path) +admin_user=$(sudo yunohost app setting $app admin_user) +upload_password=$(sudo yunohost app setting $app upload_password) +is_public=$(sudo yunohost app setting $app is_public) # Remove trailing "/" for next commands path=${path%/}