From f506747facea0f38b9180b3014399b88c0b8e79b Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Fri, 18 Mar 2016 17:31:44 +0100 Subject: [PATCH 1/4] [enh] Support new env. vars. in install script --- manifest.json | 2 +- scripts/install | 20 +++++++++++++++----- scripts/upgrade | 3 ++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/manifest.json b/manifest.json index 3b4060b..13bd8af 100644 --- a/manifest.json +++ b/manifest.json @@ -12,7 +12,7 @@ "email": "john.doe@example.com", "url": "http://example.com" }, - "multi_instance": "false", + "multi_instance": "true", "services": [ "nginx", "php5-fpm", diff --git a/scripts/install b/scripts/install index 118bbce..8963e29 100755 --- a/scripts/install +++ b/scripts/install @@ -3,13 +3,23 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +# 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 +domain=$YNH_APP_ARG_DOMAIN +path=$YNH_APP_ARG_PATH +admin=$YNH_APP_ARG_ADMIN +is_public=$YNH_APP_ARG_IS_PUBLIC # Save app settings sudo yunohost app setting $app admin -v "$admin" diff --git a/scripts/upgrade b/scripts/upgrade index e490def..07c7daf 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 +# See comments in install script +app=$YNH_APP_INSTANCE_NAME # Retrieve arguments domain=$(sudo yunohost app setting $app domain) From e63364f393a0ed8a8b8ced83fa35fe2e55fde206 Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Fri, 18 Mar 2016 18:05:41 +0100 Subject: [PATCH 2/4] [enh] make backup and restore scripts multiinstance too --- scripts/backup | 2 +- scripts/restore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index f2bc33d..0ea89b7 100755 --- a/scripts/backup +++ b/scripts/backup @@ -3,7 +3,7 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +app=$YNH_APP_INSTANCE_NAME # The parameter $1 is the backup directory location # which will be compressed afterward diff --git a/scripts/restore b/scripts/restore index 1c20f2e..83c2693 100755 --- a/scripts/restore +++ b/scripts/restore @@ -3,7 +3,7 @@ # causes the shell to exit if any subcommand or pipeline returns a non-zero status set -e -app=ynhexample +app=$YNH_APP_INSTANCE_NAME # The parameter $1 is the uncompressed restore directory location backup_dir=$1/apps/$app From 433cf2a7db80eb1aef6f5eb47b2d104dc7444cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 26 Apr 2016 16:05:50 +0200 Subject: [PATCH 3/4] [fix] Update multi-instance and requirements in the manifest --- manifest.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 13bd8af..f4cf2d3 100644 --- a/manifest.json +++ b/manifest.json @@ -12,7 +12,10 @@ "email": "john.doe@example.com", "url": "http://example.com" }, - "multi_instance": "true", + "requirements": { + "yunohost": ">> 2.3.12.1" + }, + "multi_instance": true, "services": [ "nginx", "php5-fpm", From 9b98a082c6754d382580ca4e3e0038f3bb1c338f Mon Sep 17 00:00:00 2001 From: Moul Date: Thu, 28 Apr 2016 17:53:17 +0200 Subject: [PATCH 4/4] [enh] add packaging_format key. --- manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.json b/manifest.json index 7d15b16..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."