diff --git a/pages/04.contribute/04.packaging_apps/11.helpers/packaging_apps_helpers.md b/pages/04.contribute/04.packaging_apps/11.helpers/packaging_apps_helpers.md index e2c944a3..d5bb4947 100644 --- a/pages/04.contribute/04.packaging_apps/11.helpers/packaging_apps_helpers.md +++ b/pages/04.contribute/04.packaging_apps/11.helpers/packaging_apps_helpers.md @@ -15,7 +15,7 @@ Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/2b ### APT **ynh_package_is_installed**
-[details summary="Check either a package is installed or not" class="helper-card-subtitle text-muted"] +[details summary="Check if a package is installed or not" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_package_is_installed --package=name` @@ -23,7 +23,7 @@ Doc auto-generated by [this script](https://github.com/YunoHost/yunohost/blob/2b **Arguments**: - `-p`, `--package=`: the package name to check -**Returns**: 0 if the package is installed, 1 else. +**Returns**: 0 if the package is installed, 1 otherwise. **Example**: `ynh_package_is_installed --package=yunohost && echo "installed"` @@ -110,7 +110,7 @@ Requires YunoHost version 2.2.4 or higher. ---------------- **ynh_package_autoremove**
-[details summary="Remove package(s) and their uneeded dependencies" class="helper-card-subtitle text-muted"] +[details summary="Remove package(s) and their unneeded dependencies" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_package_autoremove name [name [...]]` @@ -128,7 +128,7 @@ Requires YunoHost version 2.2.4 or higher. ---------------- **ynh_package_autopurge**
-[details summary="Purge package(s) and their uneeded dependencies" class="helper-card-subtitle text-muted"] +[details summary="Purge package(s) and their unneeded dependencies" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_package_autopurge name [name [...]]` @@ -152,8 +152,8 @@ Requires YunoHost version 2.7.2 or higher. **Usage**: `ynh_install_app_dependencies dep [dep [...]]` **Arguments**: -- `dep`: the package name to install in dependence. -- `"dep1|dep2|…"`: You can specify alternatives. It will require to install (dep1 or dep2, etc). +- `dep`: the package name to install as a dependenccy. +- `"dep1|dep2|…"`: You can specify alternatives. It will require intallation of of of them (dep1 or dep2, etc). **Details**:
This helper can/should only be called once per app @@ -188,13 +188,13 @@ Requires YunoHost version 3.8.1 or higher. ---------------- **ynh_remove_app_dependencies**
-[details summary="Remove fake package and its dependencies" class="helper-card-subtitle text-muted"] +[details summary="Remove a fake package and its dependencies" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_remove_app_dependencies` **Details**:
-Dependencies will removed only if no other package need them. +Dependencies will removed only if no other packages need them. Requires YunoHost version 2.6.4 or higher. @@ -211,9 +211,9 @@ Requires YunoHost version 2.6.4 or higher. **Usage**: `ynh_install_extra_app_dependencies --repo="repo" --package="dep1 dep2" [--key=key_url] [--name=name]` **Arguments**: -- `-r`, `--repo=`: Complete url of the extra repository. +- `-r`, `--repo=`: Complete URL of the extra repository. - `-p`, `--package=`: The packages to install from this extra repository -- `-k`, `--key=`: url to get the public key. +- `-k`, `--key=`: URL to get the public key. - `-n`, `--name=`: Name for the files for this repo, $app as default value. **Details**:
@@ -237,19 +237,19 @@ Requires YunoHost version 3.8.1 or higher. **Arguments**: - `-s`, `--src_path=`: file or directory to bind or symlink or copy. it shouldn't be in the backup dir. - `-d`, `--dest_path=`: destination file or directory inside the backup dir -- `-b`, `--is_big`: Indicate data are big (mail, video, image ...) -- `-m`, `--not_mandatory`: Indicate that if the file is missing, the backup can ignore it. +- `-b`, `--is_big`: Indicate data are big (e-mail, video, image …) +- `-m`, `--not_mandatory`: Indicate that should the file is missing, the backup can ignore it. - `arg`: Deprecated arg **Details**:
This helper can be used both in a system backup hook, and in an app backup script `ynh_backup` writes `src_path` and the relative `dest_path` into a CSV file, and it -creates the parent destination directory +creates the parent destination directory. If `dest_path` is ended by a slash it complete this path with the basename of `src_path`. -Example in the context of a wordpress app : +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 @@ -276,20 +276,20 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "/conf/" How to use `--is_big`: `--is_big` is used to specify that this part of the backup can be quite huge. -So, you don't want that your package does backup that part during ynh_backup_before_upgrade. -In the same way, an user may doesn't want to backup this big part of the app for -each of his backup. And so handle that part differently. +So, you don't want your package to back up that part during ynh_backup_before_upgrade. +In similar fashion, a user may not want to back up this big part of the app for +each of the user's backups. Having this knowledge, it can be handled differently. As this part of your backup may not be done, your restore script has to handle it. In your restore script, use `--not_mandatory` with `ynh_restore_file` -As well in your remove script, you should not remove those data ! Or an user may end up with -a failed upgrade restoring an app without data anymore ! +Do not remove those data in your remove script either! If you do, a user may end up with +a failed upgrade because of restoring an app without data! To have the benefit of `--is_big` while doing a backup, you can whether set the environement variable `BACKUP_CORE_ONLY` to 1 (`BACKUP_CORE_ONLY=1`) before the backup command. It will affect only that backup command. -Or set the config `do_not_backup_data` to 1 into the `settings.yml` of the app. This will affect -all backups for this app until the setting is removed. +Or, set the config `do_not_backup_data` to 1 in the `settings.yml` of the app. +This will affect all backups for this app until the setting is removed. Requires YunoHost version 2.4.0 or higher. Requires YunoHost version 3.5.0 or higher for the argument `--not_mandatory` @@ -301,7 +301,7 @@ Requires YunoHost version 3.5.0 or higher for the argument `--not_mandatory` ---------------- **ynh_restore**
-[details summary="Restore all files that were previously backuped in a core backup script or app backup script" class="helper-card-subtitle text-muted"] +[details summary="Restore all files that were previously backed up in a core backup script or app backup script" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_restore` @@ -322,9 +322,9 @@ Requires YunoHost version 2.6.4 or higher. **Usage**: `ynh_restore_file --origin_path=origin_path [--dest_path=dest_path] [--not_mandatory]` **Arguments**: -- `-o`, `--origin_path=`: Path where was located the file or the directory before to be backuped or relative path to $YNH_CWD where it is located in the backup archive -- `-d`, `--dest_path=`: Path where restore the file or the dir. If unspecified, 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` -- `-m`, `--not_mandatory`: Indicate that if the file is missing, the restore process can ignore it. +- `-o`, `--origin_path=`: Path where the file or the directory was located before it is to be backed up, or the relative path to $YNH_CWD of where it is located in the actual backup archive +- `-d`, `--dest_path=`: Path where restore the file or the dir. If unspecified, the destination will be `ORIGIN_PATH` or if the `ORIGIN_PATH` doesn't exist in the archive, the destination will be searched for in `backup.csv` +- `-m`, `--not_mandatory`: Indicate that if the file is missing, the restoring process can ignore it. **Examples**: @@ -344,12 +344,12 @@ Requires YunoHost version 2.6.4 or higher. **Details**:
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 +If `DEST_PATH` already exists and is lighter than 500 MB, a backup will be made in `/home/yunohost.conf/backup/`. Otherwise, the existing file is removed. if `apps/$app/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 +if no, search for a match in the CSV (e.g: conf/nginx.conf) and restore it into `/etc/nginx/conf.d/$domain.d/$app.conf` Requires YunoHost version 2.6.4 or higher. @@ -368,7 +368,7 @@ Requires YunoHost version 3.5.0 or higher for the argument --not_mandatory **Usage**: `ynh_store_file_checksum --file=file` **Arguments**: -- `-f`, `--file=`: The file on which the checksum will performed, then stored. +- `-f`, `--file=`: The file to be checksummed, then stored. **Details**:
$app should be defined when calling this helper @@ -382,7 +382,7 @@ Requires YunoHost version 2.6.4 or higher. ---------------- **ynh_backup_if_checksum_is_different**
-[details summary="Verify the checksum and backup the file if it's different" class="helper-card-subtitle text-muted"] +[details summary="Verify the checksum and backup the file if it is different" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_backup_if_checksum_is_different --file=file` @@ -393,7 +393,7 @@ Requires YunoHost version 2.6.4 or higher. **Returns**: the name of a backup file, or nothing **Details**:
-This helper is primarily meant to allow to easily backup personalised/manually +This helper is primarily meant to allow to easily back up personalised/manually modified config files. Requires YunoHost version 2.6.4 or higher. @@ -411,7 +411,7 @@ Requires YunoHost version 2.6.4 or higher. **Usage**: `ynh_delete_file_checksum --file=file` **Arguments**: -- `-f`, `--file=`: The file for which the checksum will be deleted +- `-f`, `--file=`: The file to delete the checksum for **Details**:
$app should be defined when calling this helper @@ -425,7 +425,7 @@ Requires YunoHost version 3.3.1 or higher. ---------------- **ynh_backup_before_upgrade**
-[details summary="Make a backup in case of failed upgrade" class="helper-card-subtitle text-muted"] +[details summary="Make a backup in case of a failed upgrade" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_backup_before_upgrade` @@ -476,28 +476,28 @@ Requires YunoHost version 2.7.2 or higher. ### FAIL2BAN **ynh_add_fail2ban_config**
-[details summary="Create a dedicated fail2ban config (jail and filter conf files)" class="helper-card-subtitle text-muted"] +[details summary="Create a dedicated Fail2Ban config (jail and filter conf files)" class="helper-card-subtitle text-muted"]

**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"]` **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 +- `-l`, `--logpath=`: Logfile to be checked by Fail2Ban +- `-r`, `--failregex=`: Failregex to be looked for by Fail2Ban +- `-m`, `--max_retry=`: Maximum number of retries allowed before banning an 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 for example : 'var_1 var_2 ...' +- `-v`, `--others_var=`: List of other variables to replace (separeted by a space) for example : 'var_1 var_2 ...' **Details**:
----------------------------------------------------------------------------- This will use a template in `../conf/f2b_jail.conf` and `../conf/f2b_filter.conf` -See the documentation of `ynh_add_config` for a description of the template +Consult the documentation of `ynh_add_config` for a description of the template format and how placeholders are replaced with actual variables. -Generally your template will look like that by example (for synapse): +Generally your template will look like this example (for Synapse): ``` f2b_jail.conf: [__APP__] @@ -530,12 +530,12 @@ 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 : +You can find more explainations on 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 !! +Note that the logfile need to exist before calling this helper! -To validate your regex you can test with this command: +To validate your regex you can test it with this command: ``` fail2ban-regex /var/log/YOUR_LOG_FILE_PATH /etc/fail2ban/filter.d/YOUR_APP.conf ``` @@ -549,7 +549,7 @@ Requires YunoHost version 3.5.0 or higher. ---------------- **ynh_remove_fail2ban_config**
-[details summary="Remove the dedicated fail2ban config (jail and filter conf files)" class="helper-card-subtitle text-muted"] +[details summary="Remove the dedicated Fail2Ban config (jail and filter conf files)" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_remove_fail2ban_config` @@ -576,12 +576,12 @@ Requires YunoHost version 3.5.0 or higher. **Usage**: `ynh_get_ram [--free|--total] [--ignore_swap|--only_swap]` **Arguments**: -- `-f`, `--free`: Count free RAM+swap -- `-t`, `--total`: Count total RAM+swap +- `-f`, `--free`: Count of free RAM+swap +- `-t`, `--total`: Count of total RAM+swap - `-s`, `--ignore_swap`: Ignore swap, consider only real RAM - `-o`, `--only_swap`: Ignore real RAM, consider only swap -**Returns**: the amount of free ram, in MB (MegaBytes) +**Returns**: the amount of free RAM, in MB (MegaBytes) **Details**:
Requires YunoHost version 3.8.1 or higher. @@ -593,19 +593,19 @@ Requires YunoHost version 3.8.1 or higher. ---------------- **ynh_require_ram**
-[details summary="Return 0 or 1 depending if the system has a given amount of RAM+swap free or total" class="helper-card-subtitle text-muted"] +[details summary="Return 0 or 1 depending on whether the system has a given amount of RAM+swap free or total" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_require_ram --required=RAM [--free|--total] [--ignore_swap|--only_swap]` **Arguments**: - `-r`, `--required=`: The amount to require, in MB -- `-f`, `--free`: Count free RAM+swap -- `-t`, `--total`: Count total RAM+swap +- `-f`, `--free`: Count of free RAM+swap +- `-t`, `--total`: Count of total RAM+swap - `-s`, `--ignore_swap`: Ignore swap, consider only real RAM - `-o`, `--only_swap`: Ignore real RAM, consider only swap -**Returns**: 1 if the ram is under the requirement, 0 otherwise. +**Returns**: 1 if the RAM is below the requirement, 0 otherwise. **Details**:
Requires YunoHost version 3.8.1 or higher. @@ -702,9 +702,9 @@ Requires YunoHost version 3.2.0 or higher. - `command`: command to execute **Details**:
-When using pipes, double quotes are required - otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. +When using pipes, double quotes are required — otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. -If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed. +If the command to execute uses double quotes, they have to be escaped to not be interpreted and subsequently removed. Requires YunoHost version 3.2.0 or higher. @@ -724,9 +724,9 @@ Requires YunoHost version 3.2.0 or higher. - `command`: command to execute **Details**:
-When using pipes, double quotes are required - otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. +When using pipes, double quotes are required — otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. -If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed. +If the command to execute uses double quotes, they have to be escaped to not be interpreted and subsequently removed. Requires YunoHost version 3.2.0 or higher. @@ -737,7 +737,7 @@ Requires YunoHost version 3.2.0 or higher. ---------------- **ynh_exec_warn_less**
-[details summary="Execute a command and force the result to be printed on stdout" class="helper-card-subtitle text-muted"] +[details summary="Execute a command and force the result to be printed to stdout" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_exec_warn_less "your_command [ | other_command ]"` @@ -746,9 +746,9 @@ Requires YunoHost version 3.2.0 or higher. - `command`: command to execute **Details**:
-When using pipes, double quotes are required - otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. +When using pipes, double quotes are required — otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. -If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed. +If the command to execute uses double quotes, they have to be escaped to not be interpreted and subsequently removed. Requires YunoHost version 3.2.0 or higher. @@ -768,9 +768,9 @@ Requires YunoHost version 3.2.0 or higher. - `command`: command to execute **Details**:
-When using pipes, double quotes are required - otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. +When using pipes, double quotes are required — otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. -If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed. +If the command to execute uses double quotes, they have to be escaped to not interpreted and subsequently removed. Requires YunoHost version 3.2.0 or higher. @@ -790,9 +790,9 @@ Requires YunoHost version 3.2.0 or higher. - `command`: command to execute **Details**:
-When using pipes, double quotes are required - otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. +When using pipes, double quotes are required — otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. -If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed. +If the command to execute uses double quotes, they have to be escaped to not interpreted and subsequently removed. Requires YunoHost version 3.2.0 or higher. @@ -843,8 +843,8 @@ Requires YunoHost version 3.2.0 or higher. **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. The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. -- `-l`, `--last`: Use for the last call of the helper, to fill the progression bar. +- `-t`, `--time`: Print the execution time since the last call of this helper. Especially usefull to define weights. The execution time is given for the duration since the previous call. So the weight should be applied to this previous call. +- `-l`, `--last`: Use for the last call of the helper, to fill the progress bar. **Details**:
Requires YunoHost version 3.5.0 or higher. @@ -856,7 +856,7 @@ Requires YunoHost version 3.5.0 or higher. ---------------- **ynh_return**
-[details summary="Return data to the Yunohost core for later processing +[details summary="Return data to the YunoHost core for later processing (to be used by special hooks like app config panel and core diagnosis)" class="helper-card-subtitle text-muted"]

@@ -900,9 +900,9 @@ Requires YunoHost version 3.5.0 or higher. - `command`: command to execute **Details**:
-When using pipes, double quotes are required - otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. +When using pipes, double quotes are required — otherwise, this helper will run the first command, and the whole output will be sent through the next pipe. -If the command to execute uses double quotes, they have to be escaped or they will be interpreted and removed. +If the command to execute uses double quotes, they have to be escaped to not be interpreted and subsequently removed. Requires YunoHost version 3.5.0 or higher. @@ -924,13 +924,13 @@ Requires YunoHost version 3.5.0 or higher. **Arguments**: - `-l`, `--logfile=`: absolute path of logfile - `-n`, `--nonappend`: (optional) Replace the config file instead of appending this new config. -- `-u`, `--specific_user=`: run logrotate as the specified user and group. If not specified logrotate is runned as root. +- `-u`, `--specific_user=`: run logrotate as the specified user and group. If not specified logrotate is run as root. **Details**:
If no `--logfile` is provided, `/var/log/$app` will be used as default. `logfile` can point to a directory or a file. -It's possible to use this helper multiple times, each config will be added to +It is 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. @@ -982,11 +982,11 @@ Requires YunoHost version 4.2 or higher. **Usage**: `ynh_multimedia_addfolder --source_dir="source_dir" --dest_dir="dest_dir"` **Arguments**: -- `-s`, `--source_dir=`: Source directory - The real directory which contains your medias. -- `-d`, `--dest_dir=`: Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia" +- `-s`, `--source_dir=`: Source directory — The real directory which contains your media files. +- `-d`, `--dest_dir=`: Destination directory — The name and the place of the symbolic link, relative to "/home/yunohost.multimedia" **Details**:
-This "directory" will be a symbolic link to a existing directory. +This "directory" will be a symbolic link to an existing directory. Requires YunoHost version 4.2 or higher. @@ -997,13 +997,13 @@ Requires YunoHost version 4.2 or higher. ---------------- **ynh_multimedia_addaccess**
-[details summary="Allow an user to have an write authorisation in multimedia directories" class="helper-card-subtitle text-muted"] +[details summary="Allow a user to have write authorisation in multimedia directories" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_multimedia_addaccess user_name` **Arguments**: -- `-u`, `--user_name=`: The name of the user which gain this access. +- `-u`, `--user_name=`: The name of the user which gains this access. **Details**:
Requires YunoHost version 4.2 or higher. @@ -1024,7 +1024,7 @@ Requires YunoHost version 4.2 or higher. **Usage**: `ynh_mysql_connect_as --user=user --password=password [--database=database]` **Arguments**: -- `-u`, `--user=`: the user name to connect as +- `-u`, `--user=`: the username to connect as - `-p`, `--password=`: the user password - `-d`, `--database=`: the database to connect to @@ -1068,7 +1068,7 @@ Requires YunoHost version 2.2.4 or higher. ---------------- **ynh_mysql_execute_file_as_root**
-[details summary="Execute a command from a file as root user" class="helper-card-subtitle text-muted"] +[details summary="Execute a command from a file as the root user" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_mysql_execute_file_as_root --file=file [--database=database]` @@ -1109,13 +1109,13 @@ Requires YunoHost version 2.2.4 or higher. ---------------- **ynh_mysql_user_exists**
-[details summary="Check if a mysql user exists" class="helper-card-subtitle text-muted"] +[details summary="Check if a MySQL user exists" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_mysql_user_exists --user=user` **Arguments**: -- `-u`, `--user=`: the user for which to check existence +- `-u`, `--user=`: the user to check the existence of **Returns**: 0 if the user exists, 1 otherwise. @@ -1129,7 +1129,7 @@ Requires YunoHost version 2.2.4 or higher. ---------------- **ynh_mysql_setup_db**
-[details summary="Create a database, an user and its password. Then store the password in the app's config" class="helper-card-subtitle text-muted"] +[details summary="Create a database, a user and its password. Then store the password in the app's config" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_mysql_setup_db --db_user=user --db_name=name [--db_pwd=pwd]` @@ -1141,7 +1141,7 @@ Requires YunoHost version 2.2.4 or higher. **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. +It will also be stored as "`mysqlpwd`" in the app settings. Requires YunoHost version 2.6.4 or higher. @@ -1174,13 +1174,13 @@ Requires YunoHost version 2.6.4 or higher. ### NETWORK **ynh_find_port**
-[details summary="Find a free port and return it" class="helper-card-subtitle text-muted"] +[details summary="Find an available port and return it" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_find_port --port=begin_port` **Arguments**: -- `-p`, `--port=`: port to start to search +- `-p`, `--port=`: port to start to search beginning from **Returns**: the port number @@ -1224,9 +1224,9 @@ Requires YunoHost version 3.8.0 or higher. **Usage**: `ynh_validate_ip4 --ip_address=ip_address` **Arguments**: -- `-i`, `--ip_address=`: the ipv4 address to check +- `-i`, `--ip_address=`: the IPv4 address to check -**Returns**: 0 for valid ipv4 addresses, 1 otherwise +**Returns**: 0 for valid IPv4 addresses, 1 otherwise **Example**: `ynh_validate_ip4 111.222.333.444` @@ -1246,9 +1246,9 @@ Requires YunoHost version 2.2.4 or higher. **Usage**: `ynh_validate_ip6 --ip_address=ip_address` **Arguments**: -- `-i`, `--ip_address=`: the ipv6 address to check +- `-i`, `--ip_address=`: the IPv6 address to check -**Returns**: 0 for valid ipv6 addresses, 1 otherwise +**Returns**: 0 for valid IPv6 addresses, 1 otherwise **Example**: `ynh_validate_ip6 2000:dead:beef::1` @@ -1265,22 +1265,22 @@ Requires YunoHost version 2.2.4 or higher. ### NGINX **ynh_add_nginx_config**
-[details summary="Create a dedicated nginx config" class="helper-card-subtitle text-muted"] +[details summary="Create a dedicated NGINX config" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_add_nginx_config` **Details**:
This will use a template in `../conf/nginx.conf` -See the documentation of `ynh_add_config` for a description of the template +Consult the documentation of `ynh_add_config` for a description of the template format and how placeholders are replaced with actual variables. Additionally, ynh_add_nginx_config will replace: - `#sub_path_only` by empty string if `path_url` is not `'/'` - `#root_path_only` by empty string if `path_url` *is* `'/'` -This allows to enable/disable specific behaviors dependenging on the install -location +This allows enabling/disabling specific behaviors dependenging on the installation +location. Requires YunoHost version 2.7.2 or higher. @@ -1291,7 +1291,7 @@ Requires YunoHost version 2.7.2 or higher. ---------------- **ynh_remove_nginx_config**
-[details summary="Remove the dedicated nginx config" class="helper-card-subtitle text-muted"] +[details summary="Remove the dedicated NGINX config" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_remove_nginx_config` @@ -1316,21 +1316,21 @@ Requires YunoHost version 2.7.2 or higher. **Details**:
`ynh_use_nodejs` has to be used in any app scripts before using node for the first time. -This helper will provide alias and variables to use in your scripts. +This helper provides aliases and variables to use in your scripts. To use npm or node, use the alias `ynh_npm` and `ynh_node`. -Those alias will use the correct version installed for the app. +Those aliases will use the correct version installed for the app. For example: use `ynh_npm install` instead of `npm install` -With `sudo` or `ynh_exec_as`, use instead the fallback variables `$ynh_npm` and `$ynh_node` -And propagate $PATH to sudo with $ynh_node_load_PATH -Exemple: `ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install` +With `sudo` or `ynh_exec_as`, use the fallback variables `$ynh_npm` and `$ynh_node` +instead, and propagate $PATH to sudo with $ynh_node_load_PATH +Example: `ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install` $PATH contains the path of the requested version of node. However, $PATH is duplicated into $node_PATH to outlast any manipulation of `$PATH` You can use the variable `$ynh_node_load_PATH` to quickly load your node version -in $PATH for an usage into a separate script. +in $PATH, for use in a separate script. Exemple: $ynh_node_load_PATH $final_path/script_that_use_npm.sh` Finally, to start a nodejs service with the correct version, 2 solutions @@ -1340,13 +1340,13 @@ Finally, to start a nodejs service with the correct version, 2 solutions Environment="__NODE_ENV_PATH__" ExecStart=__FINALPATH__/my_app ``` -You will replace __NODE_ENV_PATH__ with $ynh_node_load_PATH. +You will have to replace __NODE_ENV_PATH__ with $ynh_node_load_PATH. -Or node start the app directly, then you don't need to load the PATH variable +Or have node start the app directly, then you don't need to load the PATH variable ``` ExecStart=__YNH_NODE__ my_app run ``` -You will replace __YNH_NODE__ with $ynh_node +You will have to replace __YNH_NODE__ with $ynh_node 2 other variables are also available - $nodejs_path: The absolute path to node binaries for the chosen version. @@ -1361,21 +1361,21 @@ Requires YunoHost version 2.7.12 or higher. ---------------- **ynh_install_nodejs**
-[details summary="Install a specific version of nodejs" class="helper-card-subtitle text-muted"] +[details summary="Install a specific version of Node.js" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_install_nodejs --nodejs_version=nodejs_version` **Arguments**: -- `-n`, `--nodejs_version=`: Version of node to install. When possible, your should prefer to use major version number (e.g. 8 instead of 8.10.0). The crontab will then handle the update of minor versions when needed. +- `-n`, `--nodejs_version=`: Version of node to install. When possible, your should prefer to use a major version number (e.g. 8 instead of 8.10.0). The crontab will then handle the update of minor versions when needed. **Details**:
-ynh_install_nodejs will install the version of node provided as argument by using n. +ynh_install_nodejs will install the version of node provided as an 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 +That is how it changes the version. -Refer to `ynh_use_nodejs` for more information about available commands and variables +Refer to `ynh_use_nodejs` for more info about available commands and variables. Requires YunoHost version 2.7.12 or higher. @@ -1394,7 +1394,7 @@ Requires YunoHost version 2.7.12 or higher. **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. +- If no other app uses node, `n` will also be removed. Requires YunoHost version 2.7.12 or higher. @@ -1418,33 +1418,33 @@ Requires YunoHost version 2.7.12 or higher. **Arguments**: - `-p`, `--permission=`: the name for the permission (by default a permission named "main" already exist) - `-u`, `--url=`: (optional) URL for which access will be allowed/forbidden. Note that if 'show_tile' is enabled, this URL will be the URL of the tile. -- `-A`, `--additional_urls=`: (optional) List of additional URL for which access will be allowed/forbidden -- `-h`, `--auth_header=`: (optional) Define for the URL of this permission, if SSOwat pass the authentication header to the application. Default is true -- `-a`, `--allowed=`: (optional) A list of group/user to allow for the permission -- `-l`, `--label=`: (optional) Define a name for the permission. This label will be shown on the SSO and in the admin. Default is "APP_LABEL (permission name)". -- `-t`, `--show_tile=`: (optional) Define if a tile will be shown in the SSO. If yes the name of the tile will be the 'label' parameter. Defaults to false for the permission different than 'main'. -- `-P`, `--protected=`: (optional) Define if this permission is protected. If it is protected the administrator won't be able to add or remove the visitors group of this permission. Defaults to 'false'. +- `-A`, `--additional_urls=`: (optional) List of additional URLs for which access will be allowed/forbidden +- `-h`, `--auth_header=`: (optional) Define for the URL carrying this permission, if SSOwat should pass the authentication header to the app. The default is "true". +- `-a`, `--allowed=`: (optional) A list of allowed group/user for the permission +- `-l`, `--label=`: (optional) Define a name for the permission. This label will be shown on the SSO and in the admin. The default is "APP_LABEL (permission name)". +- `-t`, `--show_tile=`: (optional) Define if a tile will be shown in the SSO. If "yes", the name of the tile will be the 'label' parameter. Defaults to "false" for the permission different than 'main'. +- `-P`, `--protected=`: (optional) Define if this permission is protected. If it is protected the administrator won't be able to add or remove the visitors group of this permission. Defaults to "false". **Details**:
Example 1: `ynh_permission_create --permission=admin --url=/admin --additional_urls=domain.tld/admin /superadmin --allowed=alice bob \ --label="My app admin" --show_tile=true` -This example will create a new permission permission with this following effect: -- A tile named "My app admin" in the SSO will be available for the users alice and bob. This tile will point to the relative url '/admin'. -- Only the user alice and bob will have the access to theses following url: /admin, domain.tld/admin, /superadmin +This example will create a new permission permission with the following effect: +- A tile named "My app admin" in the SSO will be available for the users alice, and bob. This tile will point to the relative URL '/admin'. +- Only the users alice, and bob will have the access to theses following URL: /admin, domain.tld/admin, /superadmin Example 2: ynh_permission_create --permission=api --url=domain.tld/api --auth_header=false --allowed=visitors \ --label="MyApp API" --protected=true -This example will create a new protected permission. So the admin won't be able to add/remove the visitors group of this permission. -In case of an API with need to be always public it avoid that the admin break anything. -With this permission all client will be allowed to access to the url 'domain.tld/api'. +This example will create a new protected permission. So the admin won't be able to add/remove the visitor group of this permission. +In case of an API needing to be always public it avoids that the admin breaks anything. +With this permission all clients will be allowed to access the URL 'domain.tld/api'. Note that in this case no tile will be show on the SSO. Note that the auth_header parameter is to 'false'. So no authentication header will be passed to the application. Generally the API is requested by an application and enabling the auth_header has no advantage and could bring some issues in some case. -So in this case it's better to disable this option for all API. +So in this case it is better to disable this option for all API. If provided, 'url' or 'additional_urls' is assumed to be relative to the app domain/path if they start with '/'. For example: @@ -1452,23 +1452,23 @@ start with '/'. For example: /admin -> domain.tld/app/admin domain.tld/app/api -> domain.tld/app/api -'url' or 'additional_urls' can be treated as a PCRE (not lua) regex if it starts with "re:". +'url' or 'additional_urls' can be treated as a PCRE (not Lua) regex if it starts with "re:". For example: re:/api/[A-Z]*$ -> domain.tld/app/api/[A-Z]*$ re:domain.tld/app/api/[A-Z]*$ -> domain.tld/app/api/[A-Z]*$ -Note that globally the parameter 'url' and 'additional_urls' are same. The only difference is: -- 'url' is only one url, 'additional_urls' can be a list of urls. There are no limitation of 'additional_urls' -- 'url' is used for the url of tile in the SSO (if enabled with the 'show_tile' parameter) +Note that globally the parameter 'url' and 'additional_urls' are the same. The only difference is: +- 'url' is only one URL, 'additional_urls' can be a list of URLs. There is no limitation of 'additional_urls' +- 'url' is used for the URL of tile in the SSO (if enabled with the 'show_tile' parameter) About the authentication header (auth_header parameter). -The SSO pass (by default) to the application theses following HTTP header (linked to the authenticated user) to the application: +The SSO passes (by default) the following HTTP header (linked to the authenticated user) to the application: - "Auth-User": username - "Remote-User": username - - "Email": user email + - "Email": user e-mail -Generally this feature is usefull to authenticate automatically the user in the application but in some case the application don't work with theses header and theses header need to be disabled to have the application to work correctly. -See https://github.com/YunoHost/issues/issues/1420 for more informations +Generally this feature is usefull to automatically authenticate the user in the application, but in some case the application doesn't work with theis header and this header needs to be disabled to have the application work correctly. +See https://github.com/YunoHost/issues/issues/1420 for more info. Requires YunoHost version 3.7.0 or higher. @@ -1479,7 +1479,7 @@ Requires YunoHost version 3.7.0 or higher. ---------------- **ynh_permission_delete**
-[details summary="Remove a permission for the app (note that when the app is removed all permission is automatically removed)" class="helper-card-subtitle text-muted"] +[details summary="Remove a permission for the app (note that when the app is removed, all permissions are automatically removed)" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_permission_delete --permission="permission"` @@ -1518,7 +1518,7 @@ Requires YunoHost version 3.7.0 or higher. ---------------- **ynh_permission_url**
-[details summary="Redefine the url associated to a permission" class="helper-card-subtitle text-muted"] +[details summary="Redefine the URL associated to a permission" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_permission_url --permission "permission" [--url="url"] [--add_url="new-url" [ "other-new-url" ]] [--remove_url="old-url" [ "other-old-url" ]] @@ -1526,11 +1526,11 @@ Requires YunoHost version 3.7.0 or higher. **Arguments**: - `-p`, `--permission=`: the name for the permission (by default a permission named "main" is removed automatically when the app is removed) -- `-u`, `--url=`: (optional) URL for which access will be allowed/forbidden. Note that if you want to remove url you can pass an empty sting as arguments (""). -- `-a`, `--add_url=`: (optional) List of additional url to add for which access will be allowed/forbidden. -- `-r`, `--remove_url=`: (optional) List of additional url to remove for which access will be allowed/forbidden -- `-h`, `--auth_header=`: (optional) Define for the URL of this permission, if SSOwat pass the authentication header to the application -- `-c`, `--clear_urls`: (optional) Clean all urls (url and additional_urls) +- `-u`, `--url=`: (optional) URL for which access will be allowed/forbidden. Note that if you want to remove a URL you can pass an empty sting as an argument (""). +- `-a`, `--add_url=`: (optional) List of additional URLs to add, for which access will be allowed/forbidden. +- `-r`, `--remove_url=`: (optional) List of additional URLs to remove, for which access will be allowed/forbidden +- `-h`, `--auth_header=`: (optional) Define for the URL carrying this permission, if SSOwat passes the authentication header to the application +- `-c`, `--clear_urls`: (optional) Clean all URLs ("url" and "additional_urls") **Details**:
Requires YunoHost version 3.7.0 or higher. @@ -1549,11 +1549,11 @@ Requires YunoHost version 3.7.0 or higher. [--label="label"] [--show_tile=true|false] [--protected=true|false]` **Arguments**: -- `-p`, `--permission=`: the name for the permission (by default a permission named "main" already exist) -- `-a`, `--add=`: the list of group or users to enable add to the permission -- `-r`, `--remove=`: the list of group or users to remove from the permission +- `-p`, `--permission=`: the name for the permission (by default a permission named "main" already exist). +- `-a`, `--add=`: the group or list of users to grant the permission. +- `-r`, `--remove=`: the group or list of or users to revoke the permission from. - `-l`, `--label=`: (optional) Define a name for the permission. This label will be shown on the SSO and in the admin. -- `-t`, `--show_tile=`: (optional) Define if a tile will be shown in the SSO +- `-t`, `--show_tile=`: (optional) Define if a tile will be shown in the SSO. - `-P`, `--protected=`: (optional) Define if this permission is protected. If it is protected the administrator won't be able to add or remove the visitors group of this permission. **Details**:
@@ -1566,7 +1566,7 @@ Requires YunoHost version 3.7.0 or higher. ---------------- **ynh_permission_has_user**
-[details summary="Check if a permission has an user" class="helper-card-subtitle text-muted"] +[details summary="Check if a permission has a user" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_permission_has_user --permission=permission --user=user @@ -1574,7 +1574,7 @@ Requires YunoHost version 3.7.0 or higher. **Arguments**: - `-p`, `--permission=`: the permission to check -- `-u`, `--user=`: the user seek in the permission +- `-u`, `--user=`: the user to check if has the permission **Example**: `ynh_permission_has_user --permission=main --user=visitors` @@ -1627,7 +1627,7 @@ Requires YunoHost version 4.1.2 or higher. low - Less than 20 MB of RAM by pool. medium - Between 20 MB and 40 MB of RAM by pool. high - More than 40 MB of RAM by pool. -Or specify exactly the footprint, the load of the service as MB by pool instead of having a standard value. +Or, specify exactly the footprint, the load of the service as MB by pool instead of having a standard value. To have this value, use the following command and stress the service. watch -n0.5 ps -o user,cmd,%cpu,rss -u APP` @@ -1639,32 +1639,31 @@ watch -n0.5 ps -o user,cmd,%cpu,rss -u APP` - `-v`, `--phpversion=`: Version of PHP to use. - `-f`, `--footprint=`: Memory footprint of the service (low/medium/high). - `-u`, `--usage=`: Expected usage of the service (low/medium/high). -- `-p`, `--package=`: Additionnal PHP packages to install for a specific version of PHP +- `-p`, `--package=`: Additionnal PHP packages to install for a specific version of PHP. - `-d`, `--dedicated_service`: Use a dedicated PHP-FPM service instead of the common one. **Details**:
----------------------------------------------------------------------------- -The footprint of the service will be used to defined the maximum footprint we can allow, which is half the maximum RAM. -So it will be used to defined 'pm.max_children' +The footprint of the service will be used to defined the maximum footprint allowed, which is half the maximum RAM. +It defines 'pm.max_children'. A lower value for the footprint will allow more children for 'pm.max_children'. And so for 'pm.start_servers', 'pm.min_spare_servers' and 'pm.max_spare_servers' which are defined from the value of 'pm.max_children' -NOTE: 'pm.max_children' can't exceed 4 times the number of processor's cores. +NOTE: 'pm.max_children' can't exceed 4 times the number of processor cores. -The usage value will defined the way php will handle the children for the pool. -A value set as 'low' will set the process manager to 'ondemand'. Children will start only if the +The usage value will define the way PHP will handle the children for the pool. +A value of 'low' will set the process manager to 'ondemand'. Children will start only if the service is used, otherwise no child will stay alive. This config gives the lower footprint when the - service is idle. But will use more proc since it has to start a child as soon it's used. -Set as 'medium', the process manager will be at dynamic. If the service is idle, a number of children + service is idle, but will use more processor cycles since it has to start a child as soon it is used. +Set to 'medium', the process manager will be at 'dynamic'. If the service is idle, a number of children equal to pm.min_spare_servers will stay alive. So the service can be quick to answer to any request. The number of children can grow if needed. The footprint can stay low if the service is idle, but - not null. The impact on the proc is a little bit less than 'ondemand' as there's always a few + not null. The impact on the proc is a little bit less than 'ondemand' as there is always a few children already available. -Set as 'high', the process manager will be set at 'static'. There will be always as many children as +Set to 'high', the process manager will be at 'static'. There will always be as many children as 'pm.max_children', the footprint is important (but will be set as maximum a quarter of the maximum - RAM) but the impact on the proc is lower. The service will be quick to answer as there's always many - children ready to answer. + RAM) but the impact on the processor is lower. The service will be quick to answer, as there's always many children ready to answer. Requires YunoHost version 2.7.2 or higher. Requires YunoHost version 3.5.1 or higher for the argument --phpversion @@ -1699,7 +1698,7 @@ Requires YunoHost version 2.7.2 or higher. **Arguments**: - `-v`, `--phpversion`: PHP version to use with composer -- `-w`, `--workdir`: The directory from where the command will be executed. Default $final_path. +- `-w`, `--workdir`: The directory from where the command will be executed. Defaults to $final_path. - `-c`, `--commands`: Commands to execute. **Details**:
@@ -1718,9 +1717,9 @@ Requires YunoHost version 4.2 or higher. **Usage**: `ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]` **Arguments**: -- `-v`, `--phpversion`: PHP version to use with composer +- `-v`, `--phpversion`: PHP version to use with Composer - `-w`, `--workdir`: The directory from where the command will be executed. Default $final_path. -- `-a`, `--install_args`: Additional arguments provided to the composer install. Argument --no-dev already include +- `-a`, `--install_args`: Additional arguments provided to the Composer installation. Argument --no-dev already include - `-c`, `--composerversion`: Composer version to install **Details**:
@@ -1742,7 +1741,7 @@ Requires YunoHost version 4.2 or higher. **Usage**: `ynh_psql_connect_as --user=user --password=password [--database=database]` **Arguments**: -- `-u`, `--user=`: the user name to connect as +- `-u`, `--user=`: the username to connect as - `-p`, `--password=`: the user password - `-d`, `--database=`: the database to connect to @@ -1767,7 +1766,7 @@ Requires YunoHost version 3.5.0 or higher. ---------------- **ynh_psql_execute_as_root**
-[details summary="Execute a command as root user" class="helper-card-subtitle text-muted"] +[details summary="Execute a command as the root user" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_psql_execute_as_root --sql=sql [--database=database]` @@ -1786,7 +1785,7 @@ Requires YunoHost version 3.5.0 or higher. ---------------- **ynh_psql_execute_file_as_root**
-[details summary="Execute a command from a file as root user" class="helper-card-subtitle text-muted"] +[details summary="Execute a command from a file as the root user" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_psql_execute_file_as_root --file=file [--database=database]` @@ -1853,7 +1852,7 @@ Requires YunoHost version 3.5.0 or higher. | exit: Return 1 if the database doesn't exist, 0 otherwise` **Arguments**: -- `-d`, `--database=`: the database for which to check existence +- `-d`, `--database=`: the database to check the existence of **Details**:
Requires YunoHost version 3.5.0 or higher. @@ -1865,7 +1864,7 @@ Requires YunoHost version 3.5.0 or higher. ---------------- **ynh_psql_setup_db**
-[details summary="Create a database, an user and its password. Then store the password in the app's config" class="helper-card-subtitle text-muted"] +[details summary="Create a database, a user and its password. Then store the password in the app's config" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_psql_setup_db --db_user=user --db_name=name [--db_pwd=pwd]` @@ -1877,7 +1876,7 @@ Requires YunoHost version 3.5.0 or higher. **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. +It will also be stored as "psqlpwd" in the app settings. Requires YunoHost version 2.7.13 or higher. @@ -1913,8 +1912,8 @@ Requires YunoHost version 2.7.13 or higher. **Usage**: `ynh_psql_test_if_first_run` **Details**:
-It also make sure that postgresql is installed and running -Please always call this script in install and restore scripts +It also make sure that PostgreSQL is installed and running. +Please always call this script in install and restore scripts. Requires YunoHost version 2.7.13 or higher. @@ -1934,7 +1933,7 @@ Requires YunoHost version 2.7.13 or higher. **Usage**: `ynh_app_setting_get --app=app --key=key` **Arguments**: -- `-a`, `--app=`: the application id +- `-a`, `--app=`: the application ID - `-k`, `--key=`: the setting to get **Details**:
@@ -1953,7 +1952,7 @@ Requires YunoHost version 2.2.4 or higher. **Usage**: `ynh_app_setting_set --app=app --key=key --value=value` **Arguments**: -- `-a`, `--app=`: the application id +- `-a`, `--app=`: the application ID - `-k`, `--key=`: the setting name to set - `-v`, `--value=`: the setting value to set @@ -1973,7 +1972,7 @@ Requires YunoHost version 2.2.4 or higher. **Usage**: `ynh_app_setting_delete --app=app --key=key` **Arguments**: -- `-a`, `--app=`: the application id +- `-a`, `--app=`: the application ID - `-k`, `--key=`: the setting to delete **Details**:
@@ -1992,7 +1991,7 @@ Requires YunoHost version 2.2.4 or higher. **Usage**: `ynh_webpath_available --domain=domain --path_url=path` **Arguments**: -- `-d`, `--domain=`: the domain/host of the url +- `-d`, `--domain=`: the domain/host of the URL - `-p`, `--path_url=`: the web path to check the availability of **Example**: `ynh_webpath_available --domain=some.domain.tld --path_url=/coffee` @@ -2060,13 +2059,13 @@ Requires YunoHost version 2.2.4 or higher. **Usage**: `ynh_replace_string --match_string=match_string --replace_string=replace_string --target_file=target_file` **Arguments**: -- `-m`, `--match_string=`: String to be searched and replaced in the file +- `-m`, `--match_string=`: String to searched for and replaced in the file - `-r`, `--replace_string=`: String that will replace matches - `-f`, `--target_file=`: File in which the string will be replaced. **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 the 'sed' command, regular expressions and references to +sub-expressions can be used (consult sed manual page for more info). Requires YunoHost version 2.6.4 or higher. @@ -2083,7 +2082,7 @@ Requires YunoHost version 2.6.4 or higher. **Usage**: `ynh_replace_special_string --match_string=match_string --replace_string=replace_string --target_file=target_file` **Arguments**: -- `-m`, `--match_string=`: String to be searched and replaced in the file +- `-m`, `--match_string=`: String to be searched for and replaced in the file - `-r`, `--replace_string=`: String that will replace matches - `-t`, `--target_file=`: File in which the string will be replaced. @@ -2134,7 +2133,7 @@ Requires YunoHost version 2.2.4 or higher. **Arguments**: - `-s`, `--service=`: Service name (optionnal, `$app` by default) -- `-t`, `--template=`: Name of template file (optionnal, this is 'systemd' by default, meaning `../conf/systemd.service` will be used as template) +- `-t`, `--template=`: Name of template file (optional, this is 'systemd' by default, meaning `../conf/systemd.service` will be used as template) **Details**:
This will use the template `../conf/.service`. @@ -2169,18 +2168,18 @@ Requires YunoHost version 2.7.2 or higher. ---------------- **ynh_systemd_action**
-[details summary="Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started" class="helper-card-subtitle text-muted"] +[details summary="Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is started completely" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_systemd_action [--service_name=service_name] [--action=action] [ [--line_match="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ]` **Arguments**: -- `-n`, `--service_name=`: Name of the service to start. Default : `$app` +- `-n`, `--service_name=`: Name of the service to start. Defaults to `$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. If not defined it don't wait until the service is completely started. -- `-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 +- `-l`, `--line_match=`: Line to match — The line to find in the log to attest the service has finished booting. If not defined it doesn't wait until the service is started completely. +- `-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 **Details**:
Requires YunoHost version 3.5.0 or higher. @@ -2217,16 +2216,16 @@ Requires YunoHost version 2.2.4 or higher. ---------------- **ynh_user_get_info**
-[details summary="Retrieve a YunoHost user information" class="helper-card-subtitle text-muted"] +[details summary="Retrieve user info about a YunoHost user" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_user_get_info --username=username --key=key` **Arguments**: -- `-u`, `--username=`: the username to retrieve info from -- `-k`, `--key=`: the key to retrieve +- `-u`, `--username=`: the username to retrieve info from. +- `-k`, `--key=`: the key to retrieve. -**Returns**: the value associate to that key +**Returns**: the value associate to that key. **Example**: `mail=$(ynh_user_get_info 'toto' 'mail')` @@ -2245,7 +2244,7 @@ Requires YunoHost version 2.2.4 or higher. **Usage**: `ynh_user_list` -**Returns**: one username per line as strings +**Returns**: one username per line as strings. **Example**: `for u in $(ynh_user_list); do ... ; done` @@ -2285,7 +2284,7 @@ Requires YunoHost version 2.2.4 or higher. **Usage**: `ynh_system_group_exists --group=group` **Arguments**: -- `-g`, `--group=`: the group to check +- `-g`, `--group=`: the group to check. **Returns**: 0 if the group exists, 1 otherwise. @@ -2305,17 +2304,17 @@ Requires YunoHost version 3.5.0.2 or higher. **Usage**: `ynh_system_user_create --username=user_name [--home_dir=home_dir] [--use_shell] [--groups="group1 group2"]` **Arguments**: -- `-u`, `--username=`: Name of the system user that will be create -- `-h`, `--home_dir=`: Path of the home dir for the user. Usually the final path of the app. If this argument is omitted, the user will be created without home -- `-s`, `--use_shell`: Create a user using the default login shell if present. If this argument is omitted, the user will be created with /usr/sbin/nologin shell -- `-g`, `--groups`: Add the user to system groups. Typically meant to add the user to the ssh.app / sftp.app group (e.g. for borgserver, my_webapp) +- `-u`, `--username=`: Name of the system user that will be created. +- `-h`, `--home_dir=`: Path of the home dir for the user. Usually the final path of the app. If this argument is omitted, the user will be created without a home folder. +- `-s`, `--use_shell`: Create a user using the default login shell if present. If this argument is omitted, the user will be created with the /usr/sbin/nologin shell. +- `-g`, `--groups`: Add the user to system groups. Typically meant to add the user to the ssh.app / sftp.app group (e.g. for borgserver, my_webapp). **Details**:
-Create a nextcloud user with no home directory and /usr/sbin/nologin login shell (hence no login capability) : +Create a Nextcloud user with no home directory and /usr/sbin/nologin login shell (hence no login capability): ``` ynh_system_user_create --username=nextcloud ``` -Create a discourse user using /var/www/discourse as home directory and the default login shell : +Create a Discourse user using /var/www/discourse as home directory and the default login shell: ``` ynh_system_user_create --username=discourse --home_dir=/var/www/discourse --use_shell ``` @@ -2335,7 +2334,7 @@ Requires YunoHost version 2.6.4 or higher. **Usage**: `ynh_system_user_delete --username=user_name` **Arguments**: -- `-u`, `--username=`: Name of the system user that will be create +- `-u`, `--username=`: Name of the system user that will be created **Details**:
Requires YunoHost version 2.6.4 or higher. @@ -2371,7 +2370,7 @@ Requires YunoHost version 4.1.7 or higher. **Usage**: `ynh_abort_if_errors` **Details**:
-This configure the rest of the script execution such that, if an error occurs +This configures 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. @@ -2390,28 +2389,28 @@ Requires YunoHost version 2.6.4 or higher. **Usage**: `ynh_setup_source --dest_dir=dest_dir [--source_id=source_id] [--keep="file1 file2"]` **Arguments**: -- `-d`, `--dest_dir=`: Directory where to setup sources -- `-s`, `--source_id=`: Name of the source, defaults to `app` -- `-k`, `--keep=`: Space-separated list of files/folders that will be backup/restored in $dest_dir, such as a config file you don't want to overwrite. For example 'conf.json secrets.json logs/' +- `-d`, `--dest_dir=`: Directory where to set up sources. +- `-s`, `--source_id=`: Name of the source, defaults to `app`. +- `-k`, `--keep=`: Space-separated list of files/folders that will be backed up/restored in $dest_dir, such as a config file you don't want to overwrite. For example 'conf.json secrets.json logs/'. **Details**:
This helper will read `conf/${source_id}.src`, download and install the sources. -The src file need to contains: +The src file need to contain: ``` SOURCE_URL=Address to download the app archive SOURCE_SUM=Control sum -# (Optional) Program to check the integrity (sha256sum, md5sum...). Default: sha256 +# (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 +# (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. Default: true -# (Useful to get a debian package or a python wheel.) +# (Optional) If it is set to "false" don't extract the source. Default: true +# (Usefull to get a Debian package or a Python wheel.) SOURCE_EXTRACT=(true|false) ``` @@ -2486,12 +2485,12 @@ Requires YunoHost version 2.6.4 or higher. **Details**:
-The template can be by default the name of a file in the conf directory -of a YunoHost Package, a relative path or an absolute path. +The template can by default be the name of a file in the conf directory +of a YunoHost package, a relative path, or an absolute path. The helper will use the template `template` to generate a config file `destination` by replacing the following keywords with global variables -that should be defined before calling this helper : +that should be defined before calling this helper: ``` __PATH__ by $path_url __NAME__ by $app @@ -2509,11 +2508,11 @@ And any dynamic variables that should be defined before calling this helper like __VAR_2__ by $var_2 ``` -The helper will verify the checksum and backup the destination file -if it's different before applying the new template. +The helper will verify the checksum and back up the destination file +if it differs from before applying the new template. -And it will calculate and store the destination file checksum -into the app settings when configuration is done. +It will calculate and store the destination file checksum +in the app settings when the configuration finishes. Requires YunoHost version 4.1.0 or higher. @@ -2529,7 +2528,7 @@ Requires YunoHost version 4.1.0 or higher. **Usage**: `ynh_get_debian_release` -**Returns**: The Debian release codename (i.e. jessie, stretch, ...) +**Returns**: The Debian release codename (i.e. jessie, stretch, …) **Details**:
Requires YunoHost version 2.7.12 or higher. @@ -2559,7 +2558,7 @@ Requires YunoHost version 2.6.4 or higher. ---------------- **ynh_read_manifest**
-[details summary="Read the value of a key in a ynh manifest file" class="helper-card-subtitle text-muted"] +[details summary="Read the value of a key in a YunoHost manifest file" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_read_manifest --manifest="manifest.json" --key="key"` @@ -2580,7 +2579,7 @@ Requires YunoHost version 3.5.0 or higher. ---------------- **ynh_app_upstream_version**
-[details summary="Read the upstream version from the manifest or `$YNH_APP_MANIFEST_VERSION`" class="helper-card-subtitle text-muted"] +[details summary="Read the upstream version from the manifest, or `$YNH_APP_MANIFEST_VERSION`" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_app_upstream_version [--manifest="manifest.json"]` @@ -2591,11 +2590,11 @@ Requires YunoHost version 3.5.0 or higher. **Returns**: the version number of the upstream app **Details**:
-If the `manifest` is not specified, the envvar `$YNH_APP_MANIFEST_VERSION` will be used. +If the `manifest` is not specified, the environment variable `$YNH_APP_MANIFEST_VERSION` will be used. The version number in the manifest is defined by `~ynh`. -For example, if the manifest contains `4.3-2~ynh3` the function will return `4.3-2` +For example, if the manifest contains `4.3-2~ynh3`, the function will return `4.3-2`. Requires YunoHost version 3.5.0 or higher. @@ -2612,14 +2611,14 @@ Requires YunoHost version 3.5.0 or higher. **Usage**: `ynh_app_package_version [--manifest="manifest.json"]` **Arguments**: -- `-m`, `--manifest=`: Path of the manifest to read +- `-m`, `--manifest=`: Path of the manifest to read. -**Returns**: the version number of the package +**Returns**: the version number of the package. **Details**:
The version number in the manifest is defined by `~ynh`. -For example, if the manifest contains `4.3-2~ynh3` the function will return `3` +For example, if the manifest contains `4.3-2~ynh3` the function will return `3`. Requires YunoHost version 3.5.0 or higher. @@ -2630,7 +2629,7 @@ Requires YunoHost version 3.5.0 or higher. ---------------- **ynh_check_app_version_changed**
-[details summary="Checks the app version to upgrade with the existing app version and returns:" class="helper-card-subtitle text-muted"] +[details summary="Checks the app version to upgrade against the existing app version and returns:" class="helper-card-subtitle text-muted"]

**Usage**: `ynh_check_app_version_changed` @@ -2638,8 +2637,8 @@ Requires YunoHost version 3.5.0 or higher. **Returns**: `UPGRADE_APP` if the upstream version changed, `UPGRADE_PACKAGE` otherwise. **Details**:
-This helper should be used to avoid an upgrade of an app, or the upstream part -of it, when it's not needed +This helper should be used to avoid an upgrade of an app, or the upstream part of it, +when it's not needed You can force an upgrade, even if the package is up to date, with the `--force` (or `-F`) argument : ``` @@ -2660,17 +2659,17 @@ Requires YunoHost version 3.5.0 or higher. **Usage**: `ynh_compare_current_package_version --comparison (lt|le|eq|ne|ge|gt) --version ` **Arguments**: -- `--comparison`: Comparison type. Could be : `lt` (lower than), `le` (lower or equal), `eq` (equal), `ne` (not equal), `ge` (greater or equal), `gt` (greater than) -- `--version`: The version to compare. Need to be a version in the yunohost package version type (like `2.3.1~ynh4`) +- `--comparison`: Comparison type. Could be : `lt` (lower than), `le` (lower or equal), `eq` (equal), `ne` (not equal), `ge` (greater or equal), `gt` (greater than). +- `--version`: The version to compare. Need to be a version in the YunoHost package version type (like `2.3.1~ynh4`) **Returns**: 0 if the evaluation is true, 1 if false. **Example**: `ynh_compare_current_package_version --comparison lt --version 2.3.2~ynh1` **Details**:
-This helper is usually used when we need to do some actions only for some old package versions. +This helper is usually used when there is a need to carry out actions only for some old package versions. -Generally you might probably use it as follow in the upgrade script : +Generally you might probably use it as follows in the upgrade script: ``` if ynh_compare_current_package_version --comparison lt --version 2.3.2~ynh1 then