Merge pull request #12 from YunoHost/envvar

Envvar
This commit is contained in:
julienmalik 2016-05-03 12:01:25 +02:00
commit 16c2032d17
5 changed files with 25 additions and 14 deletions

View file

@ -1,6 +1,7 @@
{ {
"name": "YunoHost example app", "name": "YunoHost example app",
"id": "ynhexample", "id": "ynhexample",
"packaging_format": 1,
"description": { "description": {
"en": "Example package for YunoHost application.", "en": "Example package for YunoHost application.",
"fr": "Exemple de package dapplication pour YunoHost." "fr": "Exemple de package dapplication pour YunoHost."
@ -12,7 +13,10 @@
"email": "john.doe@example.com", "email": "john.doe@example.com",
"url": "http://example.com" "url": "http://example.com"
}, },
"multi_instance": false, "requirements": {
"yunohost": ">> 2.3.12.1"
},
"multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php5-fpm", "php5-fpm",

View file

@ -3,8 +3,7 @@
# causes the shell to exit if any subcommand or pipeline returns a non-zero status # causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e set -e
# The last argument is the app instance name app=$YNH_APP_INSTANCE_NAME
app=${!#}
# The first argument is the backup directory location for the app # The first argument is the backup directory location for the app
# from where the script is executed and which will be compressed afterward # from where the script is executed and which will be compressed afterward

View file

@ -3,15 +3,24 @@
# causes the shell to exit if any subcommand or pipeline returns a non-zero status # causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e set -e
# The last argument is the app instance name # This is a multi-instance app, meaning it can be installed several times independently
app=${!#} # 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 # Retrieve arguments
domain=$1 domain=$YNH_APP_ARG_DOMAIN
path=$2 path=$YNH_APP_ARG_PATH
admin=$3 admin=$YNH_APP_ARG_ADMIN
is_public=$4 is_public=$YNH_APP_ARG_IS_PUBLIC
language=$5 language=$YNH_APP_ARG_LANGUAGE
# Save app settings # Save app settings
sudo yunohost app setting $app admin -v "$admin" sudo yunohost app setting $app admin -v "$admin"

View file

@ -3,8 +3,7 @@
# causes the shell to exit if any subcommand or pipeline returns a non-zero status # causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e set -e
# The last argument is the app instance name app=$YNH_APP_INSTANCE_NAME
app=${!#}
# The first argument is the backup directory location of the app # The first argument is the backup directory location of the app
# from where the script is executed # from where the script is executed

View file

@ -3,8 +3,8 @@
# causes the shell to exit if any subcommand or pipeline returns a non-zero status # causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e set -e
# The last argument is the app instance name # See comments in install script
app=${!#} app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments # Retrieve arguments
domain=$(sudo yunohost app setting $app domain) domain=$(sudo yunohost app setting $app domain)