From 4edf05472941346ed5f2b49f5a8cf13778923242 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sun, 25 Feb 2024 14:26:19 +0000 Subject: [PATCH] v0.8.2 --- tools/app_generator/templates/manifest.j2 | 4 ++-- tools/app_generator/templates/upgrade.j2 | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/app_generator/templates/manifest.j2 b/tools/app_generator/templates/manifest.j2 index e1658e31..bfaec98f 100644 --- a/tools/app_generator/templates/manifest.j2 +++ b/tools/app_generator/templates/manifest.j2 @@ -28,7 +28,7 @@ yunohost = '>= {{ data.yunohost_required_version or '11.2'}}' # List of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386'] {% endif -%} architectures = "{{ data.architectures }}" # TODO : handle the "all" option (no ["all"]) -multi_instance = {% if data.multi_instance -%} true {% else -%} false {% endif -%} +multi_instance = {{ "true" if data.multi_instance else "false" }} ldap = "{{ data.ldap }}" # TODO : fixme, use actual booleans + handle the "not_relevant" value sso = "{{ data.sso }}" # FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G... You may have have a look at CI results @@ -51,7 +51,7 @@ ram.runtime = "50M" # this is a generic question - ask strings are automatically handled by YunoHost's core {% endif -%} type = "path" - default = "/example" + default = "/{{ data.app_id }}" {% endif -%} {% endif %} diff --git a/tools/app_generator/templates/upgrade.j2 b/tools/app_generator/templates/upgrade.j2 index abcda381..73687794 100644 --- a/tools/app_generator/templates/upgrade.j2 +++ b/tools/app_generator/templates/upgrade.j2 @@ -85,7 +85,8 @@ then ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" + ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env" + {{ data.custom_config_file }} fi {% if data.generator_mode == 'tutorial' -%} @@ -132,6 +133,7 @@ chown root: "$cron_path" chmod 644 "$cron_path" {% endif %} +{% if data.use_custom_config_file -%} #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) #================================================= @@ -153,16 +155,18 @@ ynh_add_config --template="{{ data.custom_config_file }}" --destination="$instal # You may need to use chmod 600 instead of 400, # for example if the app is expected to be able to modify its own config {% endif %} -chmod 400 "$install_dir/some_config_file" -chown $app:$app "$install_dir/some_config_file" +chmod 400 "$install_dir/{{ data.custom_config_file }}" +chown $app:$app "$install_dir/{{ data.custom_config_file }}" {% if data.generator_mode == 'tutorial' -%} ### For more complex cases where you want to replace stuff using regexes, ### you shoud rely on ynh_replace_string (which is basically a wrapper for sed) ### When doing so, you also need to manually call ynh_store_file_checksum ### -### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file" -### ynh_store_file_checksum --file="$install_dir/some_config_file" +### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/{{ data.custom_config_file }}" +### ynh_store_file_checksum --file="$install_dir/{{ data.custom_config_file }}" +{% endif %} + {% endif %} {% if data.main_technology not in ["php", "none"] -%}