diff --git a/packaging_apps_helpers.md b/packaging_apps_helpers.md index 396b634b..9c67f777 100644 --- a/packaging_apps_helpers.md +++ b/packaging_apps_helpers.md @@ -10,24 +10,24 @@

- Usage: ynh_use_logrotate [logfile] [--non-append|--append] [specific_user/specific_group] + Usage: ynh_use_logrotate [--logfile=/log/file] [--nonappend] [--specific_user=user/group]

Arguments:

Details:

- If no argument provided, a standard directory will be use. /var/log/${app}
You can provide a path with the directory only or with the logfile.
/parentdir/logdir
/parentdir/logdir/logfile.log

It's possible to use this helper several times, each config will be added to the same logrotate config file.
Unless you use the option --non-append

+ If no --logfile is provided, /var/log/${app} will be used as default.
logfile can be just a directory, or a full path to a logfile :
/parentdir/logdir
/parentdir/logdir/logfile.log

It's possible to use this helper multiple times, each config will be added to
the same logrotate config file. Unless you use the option --non-append

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -44,7 +44,13 @@ Usage: ynh_remove_logrotate

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -58,23 +64,23 @@

- Usage: ynh_add_systemd_config [service] [template] + Usage: ynh_add_systemd_config [--service=service] [--template=template]

Arguments:

Details:

- This will use the template ../conf/.service
to generate a systemd config, by replacing the following keywords
with global variables that should be defined before calling
this helper :

__APP__ by $app
__FINALPATH__ by $final_path

+ This will use the template ../conf/.service
to generate a systemd config, by replacing the following keywords
with global variables that should be defined before calling
this helper :

__APP__ by $app
__FINALPATH__ by $final_path

Requires YunoHost version 2.7.2 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -88,16 +94,22 @@

- Usage: ynh_remove_systemd_config [service] + Usage: ynh_remove_systemd_config [--service=service]

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.7.2 or higher.

+

+

+

+ Dude, show me the code !

@@ -116,17 +128,17 @@

Arguments:

Details:

- This will use a template in ../conf/nginx.conf
__PATH__ by $path_url
__DOMAIN__ by $domain
__PORT__ by $port
__NAME__ by $app
__FINALPATH__ by $final_path

And dynamic variables (from the last example) :
__PATH_2__ by $path_2
__PORT_2__ by $port_2

+ This will use a template in ../conf/nginx.conf
__PATH__ by $path_url
__DOMAIN__ by $domain
__PORT__ by $port
__NAME__ by $app
__FINALPATH__ by $final_path

And dynamic variables (from the last example) :
__PATH_2__ by $path_2
__PORT_2__ by $port_2

Requires YunoHost version 2.7.2 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -143,7 +155,13 @@ Usage: ynh_remove_nginx_config

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.7.2 or higher.

+

+

+

+ Dude, show me the code !

@@ -157,10 +175,22 @@

- Usage: ynh_add_fpm_config + Usage: ynh_add_fpm_config [--phpversion=7.X]

- Dude, show me the code ! + Arguments: +

+

+

+ Details: +

+ Requires YunoHost version 2.7.2 or higher.

+

+

+

+ Dude, show me the code !

@@ -177,7 +207,134 @@ Usage: ynh_remove_fpm_config

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.7.2 or higher.

+

+

+

+ Dude, show me the code ! +

+ + + +
+
+
+
ynh_add_fail2ban_config
+
Create a dedicated fail2ban config (jail and filter conf files)
+
+
+
+

+ Usage: 1: ynh_add_fail2ban_config --logpath=log_file --failregex=filter [--max_retry=max_retry] [--ports=ports] +2: ynh_add_fail2ban_config --use_template [--others_var="list of others variables to replace"] +| for example : 'var_1 var_2 ...' +

+

+ Arguments: +

    +
  • -l, --logpath= : Log file to be checked by fail2ban
  • +
  • -r, --failregex= : Failregex to be looked for by fail2ban
  • +
  • -m, --max_retry= : Maximum number of retries allowed before banning IP address - default: 3
  • +
  • -p, --ports= : Ports blocked for a banned IP address - default: http,https
  • +
  • -t, --use_template : Use this helper in template mode
  • +
  • -v, --others_var= : List of others variables to replace separeted by a space
  • +
+

+

+ Details: +

+ -----------------------------------------------------------------------------

This will use a template in ../conf/f2b_jail.conf and ../conf/f2b_filter.conf
__APP__ by $app

You can dynamically replace others variables by example :
__VAR_1__ by $var_1
__VAR_2__ by $var_2

Generally your template will look like that by example (for synapse):

f2b_jail.conf:
[__APP__]
enabled = true
port = http,https
filter = __APP__
logpath = /var/log/__APP__/logfile.log
maxretry = 3

f2b_filter.conf:
[INCLUDES]
before = common.conf
[Definition]

# Part of regex definition (just used to make more easy to make the global regex)
__synapse_start_line = .? \- synapse\..+ \-

# Regex definition.
failregex = ^%(__synapse_start_line)s INFO \- POST\-(\d+)\- \- \d+ \- Received request\: POST /_matrix/client/r0/login\??%(__synapse_start_line)s INFO \- POST\-\1\- Got login request with identifier: \{u'type': u'm.id.user', u'user'\: u'(.+?)'\}, medium\: None, address: None, user\: u'\5'%(__synapse_start_line)s WARNING \- \- (Attempted to login as @\5\:.+ but they do not exist|Failed password login for user @\5\:.+)$

ignoreregex =

-----------------------------------------------------------------------------

Note about the "failregex" option:
regex to match the password failure messages in the logfile. The
host must be matched by a group named "host". The tag "" can
be used for standard IP/hostname matching and is only an alias for
(?:::f{4,6}:)?(?P[\w\-.^_]+)

You can find some more explainations about how to make a regex here :
https://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters

Note that the logfile need to exist before to call this helper !!

To validate your regex you can test with this command:
fail2ban-regex /var/log/YOUR_LOG_FILE_PATH /etc/fail2ban/filter.d/YOUR_APP.conf

Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_remove_fail2ban_config
+
Remove the dedicated fail2ban config (jail and filter conf files)
+
+
+
+

+ Usage: ynh_remove_fail2ban_config +

+

+ Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code ! +

+
+
+
+

debug

+
+
+
+
ynh_debug
+
Debugger for app packagers
+
+
+
+

+ Usage: ynh_debug [--message=message] [--trace=1/0] +

+

+ Arguments: +

    +
  • -m, --message= : The text to print
  • +
  • -t, --trace= : Turn on or off the trace of the script. Usefull to trace nonly a small part of a script.
  • +
+

+

+ Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_debug_exec
+
Execute a command and print the result as debug
+
+
+
+

+ Usage: ynh_debug_exec command to execute +ynh_debug_exec "command to execute | following command" +In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +

+

+ Arguments: +

    +
  • command : command to execute
  • +
+

+

+ Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code !

@@ -192,30 +349,26 @@

- Usage: ynh_backup src [dest [is_big [arg]]] -the backup dir. -backup dir + Usage: ynh_backup --src_path=src_path [--dest_path=dest_path] [--is_big] [--not_mandatory]

Arguments:

-

- Example: # Wordpress app context -

Details:

- Note: this helper could be used in backup hook or in backup script inside an
app package

Details: ynh_backup writes SRC and the relative DEST into a CSV file. And it
creates the parent destination directory

If DEST is ended by a slash it complete this path with the basename of SRC.

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# => This line will be added into CSV file
# "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/etc/nginx/conf.d/$domain.d/$app.conf"

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf/nginx.conf"

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf/$app.conf"

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf"

#Deprecated usages (maintained for retro-compatibility)
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${backup_dir}/conf/nginx.conf"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf/nginx.conf"

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "/conf/"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf/$app.conf"

+ Note: this helper could be used in backup hook or in backup script inside an
app package

Details: ynh_backup writes SRC and the relative DEST into a CSV file. And it
creates the parent destination directory

If DEST is ended by a slash it complete this path with the basename of SRC.

Example in the context of a wordpress app

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# => This line will be added into CSV file
# "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/etc/nginx/conf.d/$domain.d/$app.conf"

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf/nginx.conf"

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf/$app.conf"

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf"

#Deprecated usages (maintained for retro-compatibility)
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${backup_dir}/conf/nginx.conf"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf/nginx.conf"

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "/conf/"
# => "/etc/nginx/conf.d/$domain.d/$app.conf","apps/wordpress/conf/$app.conf"

Requires YunoHost version 2.4.0 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -232,7 +385,13 @@ backup dir Usage: ynh_restore

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -246,29 +405,34 @@ backup dir

- Usage: ynh_restore_file ORIGIN_PATH [ DEST_PATH ] -to be backuped or relative path to $YNH_CWD where it is located in the backup archive -the destination will be ORIGIN_PATH or if the ORIGIN_PATH doesn't exist in -the archive, the destination will be searched into backup.csv + Usage: ynh_restore_file --origin_path=origin_path [--dest_path=dest_path] [--not_mandatory]

Arguments:

- Example: ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" # if apps/wordpress/etc/nginx/conf.d/$domain.d/$app.conf exists, restore it into # /etc/nginx/conf.d/$domain.d/$app.conf # if no, search a correspondance in the csv (eg: conf/nginx.conf) and restore it into # /etc/nginx/conf.d/$domain.d/$app.conf + Examples:

Details:

- Use the registered path in backup_list by ynh_backup to restore the file at
the good place.

If DEST_PATH already exists and is lighter than 500 Mo, a backup will be made in
/home/yunohost.conf/backup/. Otherwise, the existing file is removed.

# DON'T GIVE THE ARCHIVE PATH:
ynh_restore_file "conf/nginx.conf"

+ Use the registered path in backup_list by ynh_backup to restore the file at
the right place.

If DEST_PATH already exists and is lighter than 500 Mo, a backup will be made in
/home/yunohost.conf/backup/. Otherwise, the existing file is removed.

if apps/wordpress/etc/nginx/conf.d/$domain.d/$app.conf exists, restore it into
/etc/nginx/conf.d/$domain.d/$app.conf
if no, search for a match in the csv (eg: conf/nginx.conf) and restore it into
/etc/nginx/conf.d/$domain.d/$app.conf

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -282,22 +446,22 @@ the archive, the destination will be searched into backup.csv

- Usage: ynh_store_file_checksum file + Usage: ynh_store_file_checksum --file=file

Arguments:

Details:

- $app should be defined when calling this helper

+ $app should be defined when calling this helper

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -313,22 +477,25 @@ modified config files.

- Usage: ynh_backup_if_checksum_is_different file + Usage: ynh_backup_if_checksum_is_different --file=file

Arguments:

+

+ Returns: the name of a backup file, or nothing +

Details:

- $app should be defined when calling this helper

| ret: Return the name a the backup file, or nothing

+ $app should be defined when calling this helper

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -347,17 +514,17 @@ modified config files.

Arguments:

Details:

- $app should be defined when calling this helper

+ $app should be defined when calling this helper

Requires YunoHost version 3.3.1 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -371,16 +538,22 @@ modified config files.

- Usage: ynh_secure_remove path_to_remove + Usage: ynh_secure_remove --file=path_to_remove

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -396,7 +569,7 @@ modified config files.

- Usage: ynh_validate_ip [family] [ip_address] + Usage: ynh_validate_ip --family=family --ip_address=ip_address

Returns: 0 for valid ip addresses, 1 otherwise @@ -405,7 +578,13 @@ modified config files. Example: ynh_validate_ip 4 111.222.333.444

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -419,7 +598,7 @@ modified config files.

- Usage: ynh_validate_ip4 + Usage: ynh_validate_ip4 --ip_address=ip_address

Returns: 0 for valid ipv4 addresses, 1 otherwise @@ -428,7 +607,13 @@ modified config files. Example: ynh_validate_ip4 111.222.333.444

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -442,7 +627,7 @@ modified config files.

- Usage: ynh_validate_ip6 + Usage: ynh_validate_ip6 --ip_address=ip_address

Returns: 0 for valid ipv6 addresses, 1 otherwise @@ -451,7 +636,13 @@ modified config files. Example: ynh_validate_ip6 2000:dead:beef::1

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -466,21 +657,27 @@ modified config files.

- Usage: ynh_mysql_connect_as user pwd [db] + Usage: ynh_mysql_connect_as --user=user --password=password [--database=database]

Arguments:

Example: ynh_mysql_connect_as 'user' 'pass' <<< "UPDATE ...;" example: ynh_mysql_connect_as 'user' 'pass' < /path/to/file.sql

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -494,17 +691,23 @@ modified config files.

- Usage: ynh_mysql_execute_as_root sql [db] + Usage: ynh_mysql_execute_as_root --sql=sql [--database=database]

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -518,17 +721,23 @@ modified config files.

- Usage: ynh_mysql_execute_file_as_root file [db] + Usage: ynh_mysql_execute_file_as_root --file=file [--database=database]

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -542,12 +751,12 @@ modified config files.

- Usage: ynh_mysql_dump_db db + Usage: ynh_mysql_dump_db --database=database

Arguments:

@@ -557,7 +766,13 @@ modified config files. Example: ynh_mysql_dump_db 'roundcube' > ./dump.sql

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -571,16 +786,22 @@ modified config files.

- Usage: ynh_mysql_user_exists user + Usage: ynh_mysql_user_exists --user=user

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -594,24 +815,24 @@ modified config files.

- Usage: ynh_mysql_setup_db user name [pwd] + Usage: ynh_mysql_setup_db --db_user=user --db_name=name [--db_pwd=pwd]

Arguments:

Details:

- After executing this helper, the password of the created database will be available in $db_pwd
It will also be stored as "mysqlpwd" into the app settings.

+ After executing this helper, the password of the created database will be available in $db_pwd
It will also be stored as "mysqlpwd" into the app settings.

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -625,17 +846,23 @@ modified config files.

- Usage: ynh_mysql_remove_db user name + Usage: ynh_mysql_remove_db --db_user=user --db_name=name

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -650,12 +877,12 @@ modified config files.

- Usage: ynh_sanitize_dbid name + Usage: ynh_sanitize_dbid --db_name=name

Arguments:

@@ -665,7 +892,13 @@ modified config files. Example: dbname=$(ynh_sanitize_dbid $app)

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -675,26 +908,41 @@ modified config files.
ynh_normalize_url_path
-
Normalize the url path syntax -Handle the slash at the beginning of path and its absence at ending -Return a normalized url path
+
Normalize the url path syntax

- Usage: ynh_normalize_url_path path_to_normalize + Usage: ynh_normalize_url_path --path_url=path_to_normalize

Arguments:

- Example: url_path=$(ynh_normalize_url_path $url_path) ynh_normalize_url_path example -> /example ynh_normalize_url_path /example -> /example ynh_normalize_url_path /example/ -> /example ynh_normalize_url_path / -> / + Examples:

- Dude, show me the code ! + Details: +

+ Handle the slash at the beginning of path and its absence at ending
Return a normalized url path

Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -708,19 +956,25 @@ Return a normalized url path

- Usage: ynh_find_port begin_port + Usage: ynh_find_port --port=begin_port

Arguments:

- Example: port=$(ynh_find_port 8080) + Example: port=$(ynh_find_port --port=8080)

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -734,20 +988,26 @@ Return a normalized url path

- Usage: ynh_webpath_available domain path + Usage: ynh_webpath_available --domain=domain --path_url=path

Arguments:

- Example: ynh_webpath_available some.domain.tld /coffee + Example: ynh_webpath_available --domain=some.domain.tld --path_url=/coffee

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -761,21 +1021,27 @@ Return a normalized url path

- Usage: ynh_webpath_register app domain path + Usage: ynh_webpath_register --app=app --domain=domain --path_url=path

Arguments:

- Example: ynh_webpath_register wordpress some.domain.tld /coffee + Example: ynh_webpath_register --app=wordpress --domain=some.domain.tld --path_url=/coffee

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -793,7 +1059,7 @@ Return a normalized url path Usage:

- Dude, show me the code ! + Dude, show me the code !

@@ -812,11 +1078,11 @@ Return a normalized url path

Details:

- ynh_use_nodejs has to be used in any app scripts before using node for the first time.

2 variables are available:
- $nodejs_path: The absolute path of node for the chosen version.
- $nodejs_version: Just the version number of node for this app. Stored as 'nodejs_version' in settings.yml.
And 2 alias stored in variables:
- $nodejs_use_version: An old variable, not used anymore. Keep here to not break old apps
NB: $PATH will contain the path to node, it has to be propagated to any other shell which needs to use it.
That's means it has to be added to any systemd script.

+ ynh_use_nodejs has to be used in any app scripts before using node for the first time.

2 variables are available:
- $nodejs_path: The absolute path of node for the chosen version.
- $nodejs_version: Just the version number of node for this app. Stored as 'nodejs_version' in settings.yml.
And 2 alias stored in variables:
- $nodejs_use_version: An old variable, not used anymore. Keep here to not break old apps
NB: $PATH will contain the path to node, it has to be propagated to any other shell which needs to use it.
That's means it has to be added to any systemd script.

Requires YunoHost version 2.7.12 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -830,24 +1096,24 @@ Return a normalized url path

- Usage: ynh_install_nodejs [nodejs_version] + Usage: ynh_install_nodejs --nodejs_version=nodejs_version If possible, prefer to use major version number (e.g. 8 instead of 8.10.0). The crontab will handle the update of minor versions when needed.

Arguments:

Details:

- n (Node version management) uses the PATH variable to store the path of the version of node it is going to use.
That's how it changes the version

ynh_install_nodejs will install the version of node provided as argument by using n.

+ n (Node version management) uses the PATH variable to store the path of the version of node it is going to use.
That's how it changes the version

ynh_install_nodejs will install the version of node provided as argument by using n.

Requires YunoHost version 2.7.12 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -866,11 +1132,11 @@ Return a normalized url path

Details:

- This helper will check if another app uses the same version of node,
if not, this version of node will be removed.
If no other app uses node, n will be also removed.

+ This helper will check if another app uses the same version of node,
if not, this version of node will be removed.
If no other app uses node, n will be also removed.

Requires YunoHost version 2.7.12 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -885,19 +1151,25 @@ Return a normalized url path

- Usage: ynh_package_is_installed name + Usage: ynh_package_is_installed --package=name

Arguments:

- Example: ynh_package_is_installed 'yunohost' && echo "ok" + Example: ynh_package_is_installed --package=yunohost && echo "ok"

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -911,22 +1183,28 @@ Return a normalized url path

- Usage: ynh_package_version name + Usage: ynh_package_version --package=name

Arguments:

Returns: the version or an empty string

- Example: version=$(ynh_package_version 'yunohost') + Example: version=$(ynh_package_version --package=yunohost)

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -943,7 +1221,13 @@ Return a normalized url path Usage: ynh_package_update

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -966,7 +1250,13 @@ Return a normalized url path

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -989,7 +1279,13 @@ Return a normalized url path

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1012,7 +1308,13 @@ Return a normalized url path

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1035,7 +1337,13 @@ Return a normalized url path

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.7.2 or higher.

+

+

+

+ Dude, show me the code !

@@ -1062,7 +1370,13 @@ This helper can/should only be called once per app

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1081,11 +1395,11 @@ This helper can/should only be called once per app

Details:

- Dependencies will removed only if no other package need them.

+ Dependencies will removed only if no other package need them.

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -1096,7 +1410,7 @@ This helper can/should only be called once per app
ynh_die
Print a message to stderr and exit -usage: ynh_die MSG [RETCODE]
+usage: ynh_die --message=MSG [--ret_code=RETCODE]

@@ -1104,7 +1418,13 @@ usage: ynh_die MSG [RETCODE] Usage:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.4.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1118,10 +1438,16 @@ usage: ynh_die MSG [RETCODE]

- Usage: ynh_print_info "Some message" + Usage: ynh_print_info --message="Some message"

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1135,16 +1461,22 @@ usage: ynh_die MSG [RETCODE]

- Usage: ynh_print_warn "Text to print" + Usage: ynh_print_warn --message="Text to print"

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1158,16 +1490,22 @@ usage: ynh_die MSG [RETCODE]

- Usage: ynh_print_err "Text to print" + Usage: ynh_print_err --message="Text to print"

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1183,16 +1521,23 @@ usage: ynh_die MSG [RETCODE]

Usage: ynh_exec_err command to execute ynh_exec_err "command to execute | following command" -In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed.

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1208,16 +1553,23 @@ In case of use of pipes, you have to use double quotes. Otherwise, this helper w

Usage: ynh_exec_warn command to execute ynh_exec_warn "command to execute | following command" -In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed.

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1233,16 +1585,23 @@ In case of use of pipes, you have to use double quotes. Otherwise, this helper w

Usage: ynh_exec_warn_less command to execute ynh_exec_warn_less "command to execute | following command" -In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed.

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1258,16 +1617,23 @@ In case of use of pipes, you have to use double quotes. Otherwise, this helper w

Usage: ynh_exec_quiet command to execute ynh_exec_quiet "command to execute | following command" -In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed.

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1283,16 +1649,23 @@ In case of use of pipes, you have to use double quotes. Otherwise, this helper w

Usage: ynh_exec_fully_quiet command to execute ynh_exec_fully_quiet "command to execute | following command" -In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +In case of use of pipes, you have to use double quotes. Otherwise, this helper will be executed with the first command, then be sent to the next pipe. +If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed.

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1310,7 +1683,13 @@ In case of use of pipes, you have to use double quotes. Otherwise, this helper w WARNING: You should be careful with this helper, and never forget to use ynh_print_ON as soon as possible to restore the logging.

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1327,30 +1706,50 @@ WARNING: You should be careful with this helper, and never forget to use ynh_pri Usage: ynh_print_ON

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.2.0 or higher.

+

+

+

+ Dude, show me the code ! +

+ + + +
+
+
+
increment_progression=0
+
Print a message as INFO and show progression during an app script
+
+
+
+

+ Usage: ynh_script_progression --message=message [--weight=weight] [--time] +

+

+ Arguments: +

    +
  • -m, --message= : The text to print
  • +
  • -w, --weight= : The weight for this progression. This value is 1 by default. Use a bigger value for a longer part of the script.
  • +
  • -t, --time= : Print the execution time since the last call to this helper. Especially usefull to define weights.
  • +
  • -l, --last= : Use for the last call of the helper, to fill te progression bar.
  • +
+

+

+ Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code !

psql

-
-
-
-
ynh_psql_test_if_first_run
-
Create a master password and set up global settings -Please always call this script in install and restore scripts
-
-
-
-

- Usage: ynh_psql_test_if_first_run -

-

- Dude, show me the code ! -

-
-
-
@@ -1360,21 +1759,27 @@ Please always call this script in install and restore scripts

- Usage: ynh_psql_connect_as user pwd [db] + Usage: ynh_psql_connect_as --user=user --password=password [--database=database]

Arguments:

    -
  • user : the user name to connect as
  • -
  • pwd : the user password
  • -
  • db : the database to connect to
  • +
  • -u, --user : the user name to connect as
  • +
  • -p, --password : the user password
  • +
  • -d, --database : the database to connect to

Example: ynh_psql_connect_as 'user' 'pass' <<< "UPDATE ...;" example: ynh_psql_connect_as 'user' 'pass' < /path/to/file.sql

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code !

@@ -1383,21 +1788,28 @@ Please always call this script in install and restore scripts
ynh_psql_execute_as_root
-
# Execute a command as root user
+
Execute a command as root user

- Usage: ynh_psql_execute_as_root sql [db] + Usage: ynh_psql_execute_as_root --sql=sql [--database=database]

Arguments:

    -
  • sql : the SQL command to execute
  • +
  • -s, --sql : the SQL command to execute
  • +
  • -d, --database : the database to connect to

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code !

@@ -1411,97 +1823,23 @@ Please always call this script in install and restore scripts

- Usage: ynh_psql_execute_file_as_root file [db] + Usage: ynh_psql_execute_file_as_root --file=file [--database=database]

Arguments:

    -
  • file : the file containing SQL commands
  • -
  • db : the database to connect to
  • -
-

-

- Dude, show me the code ! -

-
-
-
-
-
-
-
ynh_psql_setup_db
-
Create a database, an user and its password. Then store the password in the app's config
-
-
-
-

- Usage: ynh_psql_setup_db user name [pwd] -

-

- Arguments: -

    -
  • user : Owner of the database
  • -
  • name : Name of the database
  • -
  • pwd : Password of the database. If not given, a password will be generated
  • +
  • -f, --file : the file containing SQL commands
  • +
  • -d, --database : the database to connect to

Details:

- After executing this helper, the password of the created database will be available in $db_pwd
It will also be stored as "psqlpwd" into the app settings.

+ Requires YunoHost version 3.?.? or higher.

- Dude, show me the code ! -

-
-
-
-
-
-
-
ynh_psql_create_db
-
Create a database and grant privilegies to a user
-
-
-
-

- Usage: ynh_psql_create_db db [user [pwd]] -

-

- Arguments: -

    -
  • db : the database name to create
  • -
  • user : the user to grant privilegies
  • -
  • pwd : the user password
  • -
-

-

- Dude, show me the code ! -

-
-
-
-
-
-
-
ynh_psql_remove_db
-
Drop a database
-
-
-
-

- Usage: ynh_psql_drop_db db -

-

- Arguments: -

    -
  • db : the database name to drop
  • -
  • user : the user to drop
  • -
-

-

- Dude, show me the code ! + Dude, show me the code !

@@ -1515,12 +1853,12 @@ Please always call this script in install and restore scripts

- Usage: ynh_psql_dump_db db + Usage: ynh_psql_dump_db --database=database

Arguments:

@@ -1530,53 +1868,132 @@ Please always call this script in install and restore scripts Example: ynh_psql_dump_db 'roundcube' > ./dump.sql

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code !

-
-
ynh_psql_create_user
-
Create a user
+
+
ynh_psql_user_exists
+
Check if a psql user exists
-
+

- Usage: ynh_psql_create_user user pwd [host] + Usage: ynh_psql_user_exists --user=user

Arguments:

    -
  • user : the user name to create
  • +
  • -u, --user : the user for which to check existence

- Dude, show me the code ! + Dude, show me the code !

-
-
ynh_psql_drop_user
-
Drop a user
+
+
ynh_psql_database_exists
+
Check if a psql database exists
-
+

- Usage: ynh_psql_drop_user user + Usage: ynh_psql_database_exists --database=database

Arguments:

    -
  • user : the user name to drop
  • +
  • -d, --database : the database for which to check existence

- Dude, show me the code ! + Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_psql_setup_db
+
Create a database, an user and its password. Then store the password in the app's config
+
+
+
+

+ Usage: ynh_psql_setup_db --db_user=user --db_name=name [--db_pwd=pwd] +

+

+ Arguments: +

    +
  • -u, --db_user : Owner of the database
  • +
  • -n, --db_name : Name of the database
  • +
  • -p, --db_pwd : Password of the database. If not given, a password will be generated
  • +
+

+

+ Details: +

+ After executing this helper, the password of the created database will be available in $db_pwd
It will also be stored as "psqlpwd" into the app settings.

+

+

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_psql_remove_db
+
Remove a database if it exists, and the associated user
+
+
+
+

+ Usage: ynh_psql_remove_db --db_user=user --db_name=name +

+

+ Arguments: +

    +
  • -u, --db_user : Owner of the database
  • +
  • -n, --db_name : Name of the database
  • +
+

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_psql_test_if_first_run
+
Create a master password and set up global settings +Please always call this script in install and restore scripts
+
+
+
+

+ Usage: ynh_psql_test_if_first_run +

+

+ Dude, show me the code !

@@ -1591,17 +2008,23 @@ Please always call this script in install and restore scripts

- Usage: ynh_app_setting_get app key + Usage: ynh_app_setting_get --app=app --key=key

Arguments:

    -
  • app : the application id
  • -
  • key : the setting to get
  • +
  • -a, --app : the application id
  • +
  • -k, --key : the setting to get

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1615,18 +2038,24 @@ Please always call this script in install and restore scripts

- Usage: ynh_app_setting_set app key value + Usage: ynh_app_setting_set --app=app --key=key --value=value

Arguments:

    -
  • app : the application id
  • -
  • key : the setting name to set
  • -
  • value : the setting value to set
  • +
  • -a, --app : the application id
  • +
  • -k, --key : the setting name to set
  • +
  • -v, --value : the setting value to set

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1640,17 +2069,23 @@ Please always call this script in install and restore scripts

- Usage: ynh_app_setting_delete app key + Usage: ynh_app_setting_delete --app=app --key=key

Arguments:

    -
  • app : the application id
  • -
  • key : the setting to delete
  • +
  • -a, --app : the application id
  • +
  • -k, --key : the setting to delete

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1665,19 +2100,25 @@ Please always call this script in install and restore scripts

- Usage: ynh_string_random [length] + Usage: ynh_string_random [--length=string_length]

Arguments:

    -
  • length : the string length to generate (default: 24)
  • +
  • -l, --length : the string length to generate (default: 24)

- Example: pwd=$(ynh_string_random 8) + Example: pwd=$(ynh_string_random --length=8)

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1691,24 +2132,24 @@ Please always call this script in install and restore scripts

- Usage: ynh_replace_string match_string replace_string target_file + Usage: ynh_replace_string --match_string=match_string --replace_string=replace_string --target_file=target_file

Arguments:

Details:

- As this helper is based on sed command, regular expressions and
references to sub-expressions can be used
(see sed manual page for more information)

+ As this helper is based on sed command, regular expressions and
references to sub-expressions can be used
(see sed manual page for more information)

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -1722,24 +2163,24 @@ Please always call this script in install and restore scripts

- Usage: ynh_replace_special_string match_string replace_string target_file + Usage: ynh_replace_special_string --match_string=match_string --replace_string=replace_string --target_file=target_file

Arguments:

Details:

- This helper will use ynh_replace_string, but as you can use special
characters, you can't use some regular expressions and sub-expressions.

+ This helper will use ynh_replace_string, but as you can use special
characters, you can't use some regular expressions and sub-expressions.

Requires YunoHost version 2.7.7 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -1759,11 +2200,11 @@ Please always call this script in install and restore scripts

Details:

- This configure the rest of the script execution such that, if an error occurs
or if an empty variable is used, the execution of the script stops
immediately and a call to `ynh_clean_setup` is triggered if it has been
defined by your script.

+ This configure the rest of the script execution such that, if an error occurs
or if an empty variable is used, the execution of the script stops
immediately and a call to `ynh_clean_setup` is triggered if it has been
defined by your script.

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -1783,7 +2224,184 @@ Please always call this script in install and restore scripts Returns: The Debian release codename (i.e. jessie, stretch, ...)

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.7.12 or higher.

+

+

+

+ Dude, show me the code ! +

+ + + +
+
+
+
ynh_systemd_action
+
Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
+
+
+
+

+ Usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ] + If not defined it don't wait until the service is completely started. + WARNING: When using --line_match, you should always add `ynh_clean_check_starting` into your + `ynh_clean_setup` at the beginning of the script. Otherwise, tail will not stop in case of failure + of the script. The script will then hang forever. +

+

+ Arguments: +

    +
  • -n, --service_name= : Name of the service to start. Default : $app
  • +
  • -a, --action= : Action to perform with systemctl. Default: start
  • +
  • -l, --line_match= : Line to match - The line to find in the log to attest the service have finished to boot.
  • +
  • -p, --log_path= : Log file - Path to the log file. Default : /var/log/$app/$app.log
  • +
  • -t, --timeout= : Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
  • +
  • -e, --length= : Length of the error log : Default : 20
  • +
+

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_clean_check_starting
+
Clean temporary process and file used by ynh_check_starting +(usually used in ynh_clean_setup scripts)
+
+
+
+

+ Usage: ynh_clean_check_starting +

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_read_manifest
+
Read the value of a key in a ynh manifest file
+
+
+
+

+ Usage: ynh_read_manifest manifest key +

+

+ Arguments: +

    +
  • -m, --manifest= : Path of the manifest to read
  • +
  • -k, --key= : Name of the key to find
  • +
+

+

+ Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_app_upstream_version
+
Read the upstream version from the manifest +The version number in the manifest is defined by ~ynh +For example : 4.3-2~ynh3 +This include the number before ~ynh +In the last example it return 4.3-2
+
+
+
+

+ Usage: ynh_app_upstream_version [-m manifest] +

+

+ Arguments: +

    +
  • -m, --manifest= : Path of the manifest to read
  • +
+

+

+ Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_app_package_version
+
Read package version from the manifest +The version number in the manifest is defined by ~ynh +For example : 4.3-2~ynh3 +This include the number after ~ynh +In the last example it return 3
+
+
+
+

+ Usage: ynh_app_package_version [-m manifest] +

+

+ Arguments: +

    +
  • -m, --manifest= : Path of the manifest to read
  • +
+

+

+ Details: +

+ Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code ! +

+
+
+
+
+
+
+
ynh_check_app_version_changed
+
Checks the app version to upgrade with the existing app version and returns: +- UPGRADE_APP if the upstream app version has changed +- UPGRADE_PACKAGE if only the YunoHost package has changed
+
+
+
+

+ Usage: ynh_check_app_version_changed +

+

+ Details: +

+ It stops the current script without error if the package is up-to-date

This helper should be used to avoid an upgrade of an app, or the upstream part
of it, when it's not needed

To force an upgrade, even if the package is up to date,
you have to set the variable YNH_FORCE_UPGRADE before.
example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp

Requires YunoHost version 3.?.? or higher.

+

+

+

+ Dude, show me the code !

@@ -1798,19 +2416,25 @@ Please always call this script in install and restore scripts

- Usage: ynh_user_exists username + Usage: ynh_user_exists --username=username

Arguments:

Example: ynh_user_exists 'toto' || exit 1

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1824,13 +2448,13 @@ Please always call this script in install and restore scripts

- Usage: ynh_user_get_info username key + Usage: ynh_user_get_info --username=username --key=key

Arguments:

@@ -1840,7 +2464,13 @@ Please always call this script in install and restore scripts Example: mail=$(ynh_user_get_info 'toto' 'mail')

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1863,7 +2493,13 @@ Please always call this script in install and restore scripts Example: for u in $(ynh_user_list); do ...

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.4.0 or higher.

+

+

+

+ Dude, show me the code !

@@ -1877,16 +2513,45 @@ Please always call this script in install and restore scripts

- Usage: ynh_system_user_exists username + Usage: ynh_system_user_exists --username=username

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code ! +

+
+ + +
+
+
+
ynh_system_group_exists
+
Check if a group exists on the system
+
+
+
+

+ Usage: ynh_system_group_exists --group=group +

+

+ Arguments: +

    +
  • -g, --group : the group to check
  • +
+

+

+ Dude, show me the code !

@@ -1900,17 +2565,36 @@ Please always call this script in install and restore scripts

- Usage: ynh_system_user_create user_name [home_dir] + Usage: ynh_system_user_create --username=user_name [--home_dir=home_dir] [--use_shell]

Arguments:

- Dude, show me the code ! + Examples:

+

+

+ Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1924,16 +2608,22 @@ Please always call this script in install and restore scripts

- Usage: ynh_system_user_delete user_name + Usage: ynh_system_user_delete --username=user_name

Arguments:

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.6.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1957,7 +2647,13 @@ Please always call this script in install and restore scripts Example: yunohost user info tata --output-as plain | ynh_get_plain_key mail

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.2.4 or higher.

+

+

+

+ Dude, show me the code !

@@ -1978,7 +2674,13 @@ ynh_clean_setup () { ynh_abort_if_errors

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.7.2 or higher.

+

+

+

+ Dude, show me the code !

@@ -1999,7 +2701,13 @@ ynh_clean_setup () { ynh_abort_if_errors

- Dude, show me the code ! + Details: +

+ Requires YunoHost version 2.7.2 or higher.

+

+

+

+ Dude, show me the code !

@@ -2013,23 +2721,23 @@ ynh_abort_if_errors

- Usage: ynh_setup_source dest_dir [source_id] + Usage: ynh_setup_source --dest_dir=dest_dir [--source_id=source_id]

Arguments:

Details:

- The file conf/app.src need to contains:

SOURCE_URL=Address to download the app archive
SOURCE_SUM=Control sum
# (Optional) Program to check the integrity (sha256sum, md5sum...)
# default: sha256
SOURCE_SUM_PRG=sha256
# (Optional) Archive format
# default: tar.gz
SOURCE_FORMAT=tar.gz
# (Optional) Put false if sources are directly in the archive root
# default: true
SOURCE_IN_SUBDIR=false
# (Optionnal) Name of the local archive (offline setup support)
# default: ${src_id}.${src_format}
SOURCE_FILENAME=example.tar.gz
# (Optional) If it set as false don't extract the source.
# (Useful to get a debian package or a python wheel.)
# default: true
SOURCE_EXTRACT=(true|false)

Details:
This helper downloads sources from SOURCE_URL if there is no local source
archive in /opt/yunohost-apps-src/APP_ID/SOURCE_FILENAME

Next, it checks the integrity with "SOURCE_SUM_PRG -c --status" command.

If it's ok, the source archive will be uncompressed in $dest_dir. If the
SOURCE_IN_SUBDIR is true, the first level directory of the archive will be
removed.

Finally, patches named sources/patches/${src_id}-*.patch and extra files in
sources/extra_files/$src_id will be applied to dest_dir

+ The file conf/app.src need to contains:

SOURCE_URL=Address to download the app archive
SOURCE_SUM=Control sum
# (Optional) Program to check the integrity (sha256sum, md5sum...)
# default: sha256
SOURCE_SUM_PRG=sha256
# (Optional) Archive format
# default: tar.gz
SOURCE_FORMAT=tar.gz
# (Optional) Put false if sources are directly in the archive root
# default: true
# Instead of true, SOURCE_IN_SUBDIR could be the number of sub directories
# to remove.
SOURCE_IN_SUBDIR=false
# (Optionnal) Name of the local archive (offline setup support)
# default: ${src_id}.${src_format}
SOURCE_FILENAME=example.tar.gz
# (Optional) If it set as false don't extract the source.
# (Useful to get a debian package or a python wheel.)
# default: true
SOURCE_EXTRACT=(true|false)

Details:
This helper downloads sources from SOURCE_URL if there is no local source
archive in /opt/yunohost-apps-src/APP_ID/SOURCE_FILENAME

Next, it checks the integrity with "SOURCE_SUM_PRG -c --status" command.

If it's ok, the source archive will be uncompressed in $dest_dir. If the
SOURCE_IN_SUBDIR is true, the first level directory of the archive will be
removed.
If SOURCE_IN_SUBDIR is a numeric value, 2 for example, the 2 first level
directories will be removed

Finally, patches named sources/patches/${src_id}-*.patch and extra files in
sources/extra_files/$src_id will be applied to dest_dir

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -2060,11 +2768,11 @@ ynh_abort_if_errors

Details:

- $domain and $path_url should be defined externally (and correspond to the domain.tld and the /path (of the app?))

+ $domain and $path_url should be defined externally (and correspond to the domain.tld and the /path (of the app?))

Requires YunoHost version 2.6.4 or higher.

- Dude, show me the code ! + Dude, show me the code !

@@ -2094,11 +2802,12 @@ ynh_abort_if_errors

- Dude, show me the code ! + Dude, show me the code !

+

Generated by this script on 2019-04-08 18:53:09.449596 (version 3.5.1.1)