diff --git a/manifest.json b/manifest.json index 347fbd8..b327c3f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,7 @@ { "name": "YunoHost example app", "id": "ynhexample", + "packaging_format": 1, "description": { "en": "Example package for YunoHost application.", "fr": "Exemple de package d’application pour YunoHost." @@ -12,7 +13,10 @@ "email": "john.doe@example.com", "url": "http://example.com" }, - "multi_instance": false, + "requirements": { + "yunohost": ">> 2.3.12.1" + }, + "multi_instance": true, "services": [ "nginx", "php5-fpm", diff --git a/scripts/backup b/scripts/backup index f576013..225481a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -3,8 +3,7 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -# The last argument is the app instance name -app=${!#} +app=$YNH_APP_INSTANCE_NAME # The first argument is the backup directory location for the app # from where the script is executed and which will be compressed afterward diff --git a/scripts/install b/scripts/install index 1b92cf1..e85d91d 100755 --- a/scripts/install +++ b/scripts/install @@ -3,15 +3,24 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -# The last argument is the app instance name -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 # Retrieve arguments -domain=$1 -path=$2 -admin=$3 -is_public=$4 -language=$5 +domain=$YNH_APP_ARG_DOMAIN +path=$YNH_APP_ARG_PATH +admin=$YNH_APP_ARG_ADMIN +is_public=$YNH_APP_ARG_IS_PUBLIC +language=$YNH_APP_ARG_LANGUAGE # Save app settings sudo yunohost app setting $app admin -v "$admin" diff --git a/scripts/restore b/scripts/restore index 62b3a3e..557b788 100755 --- a/scripts/restore +++ b/scripts/restore @@ -3,8 +3,7 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -# The last argument is the app instance name -app=${!#} +app=$YNH_APP_INSTANCE_NAME # The first argument is the backup directory location of the app # from where the script is executed diff --git a/scripts/upgrade b/scripts/upgrade index 62b7716..37d8816 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,8 +3,8 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -# The last argument is the app instance name -app=${!#} +# See comments in install script +app=$YNH_APP_INSTANCE_NAME # Retrieve arguments domain=$(sudo yunohost app setting $app domain)