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%/}