From 4665ebe3a452c1fb37f94a696cfdccbb898b4789 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 7 Feb 2021 16:17:24 +0100 Subject: [PATCH 01/10] Fix change_url --- scripts/change_url | 6 +----- scripts/install | 7 ++++--- scripts/remove | 10 ---------- scripts/restore | 2 +- scripts/upgrade | 21 ++++++++------------- 5 files changed, 14 insertions(+), 32 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 972eb62..1e796e5 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,11 +28,7 @@ ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) - -# Add settings here as needed by your application -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$db_name -#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP diff --git a/scripts/install b/scripts/install index 09c35ec..84489e5 100644 --- a/scripts/install +++ b/scripts/install @@ -179,13 +179,14 @@ ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --lin #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/remove b/scripts/remove index 3fb0543..8bf492d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -77,16 +77,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index f23531c..34e581e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -120,7 +120,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" #================================================= # CREATE LDAP USER diff --git a/scripts/upgrade b/scripts/upgrade index 0c012c6..a6f35d4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,6 +71,13 @@ if [[ -z "$ldap_user" ]]; then yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikijsLdap" --mail ${ldap_user}@$domain --password $ldap_password -q 0 fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + # Remove yarn repository ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list" @@ -203,7 +210,7 @@ ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH" ynh_script_progression --message="Securing files and directories..." # Set permissions on app files -chown -R "$app":"$app" "$final_path" +chown -R $app: "$final_path" #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -212,18 +219,6 @@ ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/log/$app/$app.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # START SYSTEMD SERVICE #================================================= From 095b22fe1dd7fe9f2a619bbbd6a2a4c57d5539ce Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 7 Feb 2021 16:30:47 +0100 Subject: [PATCH 02/10] Upgrade to nodeJS 14 --- manifest.json | 6 +++--- scripts/_common.sh | 2 +- scripts/change_url | 4 ++-- scripts/install | 2 +- scripts/restore | 4 ++-- scripts/upgrade | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest.json b/manifest.json index 52b6cb3..e361b41 100644 --- a/manifest.json +++ b/manifest.json @@ -3,10 +3,10 @@ "id": "wikijs", "packaging_format": 1, "description": { - "en": "An open source, modern and powerful wiki app built on Node.js, Git and Markdown.", - "fr": "Un wiki moderne et open source propulsé Node.js, Git et Markdown." + "en": "Open source, modern and powerful wiki app built on Node.js, Git and Markdown.", + "fr": "Wiki moderne et open source propulsé Node.js, Git et Markdown." }, - "version": "2.5.170~ynh2", + "version": "2.5.170~ynh3", "url": "https://wiki.js.org/", "license": "AGPL-3.0-or-later", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 9145635..2d1d65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ # dependencies used by the app pkg_dependencies="postgresql postgresql-contrib" -NODEJS_VERSION=12 +NODEJS_VERSION=14 #================================================= # PERSONAL HELPERS diff --git a/scripts/change_url b/scripts/change_url index 1e796e5..b721999 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -70,7 +70,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service" +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" #================================================= # MODIFY URL IN NGINX CONF @@ -109,7 +109,7 @@ fi ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 84489e5..7959da0 100644 --- a/scripts/install +++ b/scripts/install @@ -73,7 +73,7 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A POSTGRESQL DATABASE diff --git a/scripts/restore b/scripts/restore index 34e581e..311e47a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -76,7 +76,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" ynh_script_progression --message="Restoring user rights..." # Restore permissions on app files -chown -R "$app":"$app" "$final_path" +chown -R $app: "$final_path" #================================================= # SPECIFIC RESTORATION @@ -88,7 +88,7 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index a6f35d4..ade440b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -117,7 +117,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service" +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -166,7 +166,7 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -224,7 +224,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" #================================================= # RELOAD NGINX From 2525fb24ba039781c8f22685e469d26e7e84ddad Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 7 Feb 2021 16:35:03 +0100 Subject: [PATCH 03/10] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index aee678f..5080860 100644 --- a/check_process +++ b/check_process @@ -29,7 +29,7 @@ backup_restore=1 multi_instance=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Options Email=yalh@yahoo.com Notification=yes From f4e46f289c5446797bb40359b078804f2c514895 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 25 Feb 2021 15:38:05 +0100 Subject: [PATCH 04/10] Small typos --- scripts/install | 12 +++++------- scripts/upgrade | 8 ++++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index 7959da0..39ae359 100644 --- a/scripts/install +++ b/scripts/install @@ -174,7 +174,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" #================================================= # SETUP SSOWAT @@ -184,8 +184,6 @@ ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi @@ -201,10 +199,10 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= ynh_script_progression --message="Sending ReadMe to admin..." -ynh_replace_string --match_string="__LDAP_USER__" --replace_string="$ldap_user" --target_file="../conf/ldap_message" -ynh_replace_string --match_string="__LDAP_PASSWORD__" --replace_string="$ldap_password" --target_file="../conf/ldap_message" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/ldap_message" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/ldap_message" +ynh_replace_string --match_string="__LDAP_USER__" --replace_string="$ldap_user" --target_file="../conf/ldap_message" +ynh_replace_string --match_string="__LDAP_PASSWORD__" --replace_string="$ldap_password" --target_file="../conf/ldap_message" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/ldap_message" +ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/ldap_message" ynh_send_readme_to_admin --app_message="../conf/ldap_message" --recipients="root" --type='install' diff --git a/scripts/upgrade b/scripts/upgrade index ade440b..b560508 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -238,10 +238,10 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= ynh_script_progression --message="Sending ReadMe to admin..." -ynh_replace_string --match_string="__LDAP_USER__" --replace_string="$ldap_user" --target_file="../conf/ldap_message" -ynh_replace_string --match_string="__LDAP_PASSWORD__" --replace_string="$ldap_password" --target_file="../conf/ldap_message" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/ldap_message" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/ldap_message" +ynh_replace_string --match_string="__LDAP_USER__" --replace_string="$ldap_user" --target_file="../conf/ldap_message" +ynh_replace_string --match_string="__LDAP_PASSWORD__" --replace_string="$ldap_password" --target_file="../conf/ldap_message" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/ldap_message" +ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/ldap_message" ynh_send_readme_to_admin --app_message="../conf/ldap_message" --recipients="root" --type='upgrade' From 1723550d1debe3ce29e71e7e1b8d919f81212516 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Mar 2021 13:29:53 +0100 Subject: [PATCH 05/10] Cleaning up --- README.md | 2 +- manifest.json | 10 +--------- pull_request_template.md | 4 +--- scripts/install | 15 ++++++++------- scripts/restore | 2 +- scripts/upgrade | 32 +++++++++++--------------------- 6 files changed, 23 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 1163b4c..f72868c 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Wiki.js is a copylefted libre software, modern and powerful wiki app built on No ## Documentation * Official documentation: https://docs-beta.requarks.io/ - * YunoHost documentation: https://yunohost.org/#/app_wikijs + * YunoHost documentation: https://yunohost.org/en/app_wikijs ## YunoHost specific features diff --git a/manifest.json b/manifest.json index e361b41..e321ce8 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.1.7" }, "multi_instance": true, "services": [ @@ -24,19 +24,11 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Wiki.js", - "fr": "Choisissez un nom de domaine pour Wiki.js" - }, "example": "example.com" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true } ] diff --git a/pull_request_template.md b/pull_request_template.md index ccfefad..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## Package_check results --- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/wikijs_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/wikijs_ynh%20PR-NUM-%20(USERNAME)/) +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/install b/scripts/install index 39ae359..4136f35 100644 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=ldap_user --value=$ldap_user ynh_app_setting_set --app=$app --key=ldap_password --value=$ldap_password @@ -136,12 +135,14 @@ ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH" #================================================= ynh_script_progression --message="Modifying a config file..." -config_file="$final_path/config.yml" -cp -f ../conf/config.sample.yml $config_file +# config_file="$final_path/config.yml" +# cp -f ../conf/config.sample.yml $config_file -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file" +# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file" +# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file" +# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file" + +ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -159,7 +160,7 @@ ynh_store_file_checksum --file="$config_file" ynh_script_progression --message="Securing files and directories..." # Set permissions to app files -chown -R "$app":"$app" "$final_path" +chown -R $app: $final_path #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/restore b/scripts/restore index 311e47a..4cee1f8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -76,7 +76,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" ynh_script_progression --message="Restoring user rights..." # Restore permissions on app files -chown -R $app: "$final_path" +chown -R $app: $final_path #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index b560508..dc24588 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,10 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) - -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) - db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) port=$(ynh_app_setting_get --app=$app --key=port) @@ -41,15 +38,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) @@ -183,16 +171,18 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= ynh_script_progression --message="Modifying a config file..." -config_file="$final_path/config.yml" -ynh_backup_if_checksum_is_different --file=$config_file -cp -f ../conf/config.sample.yml $config_file +# config_file="$final_path/config.yml" +# ynh_backup_if_checksum_is_different --file=$config_file +# cp -f ../conf/config.sample.yml $config_file -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file" +# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file" +# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config_file" +# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config_file" -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$config_file" +# # Recalculate and store the checksum of the file for the next upgrade. +# ynh_store_file_checksum --file="$config_file" + +ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml" #================================================= # SETUP SYSTEMD @@ -210,7 +200,7 @@ ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH" ynh_script_progression --message="Securing files and directories..." # Set permissions on app files -chown -R $app: "$final_path" +chown -R $app: $final_path #================================================= # INTEGRATE SERVICE IN YUNOHOST From c31739b1add3309d6e26fcc0f9fb423de8314cc1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 13 May 2021 22:15:02 +0200 Subject: [PATCH 06/10] Apply last example_ynh --- scripts/change_url | 4 ++-- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 4 ++-- scripts/upgrade | 48 +++++++++++++++++++++++----------------------- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 29e33d5..354a070 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -71,7 +71,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service" #================================================= # MODIFY URL IN NGINX CONF @@ -110,7 +110,7 @@ fi ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index bc99cd9..4eff355 100644 --- a/scripts/install +++ b/scripts/install @@ -159,7 +159,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 2536b4a..d9d022c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -50,7 +50,7 @@ ynh_remove_systemd_config ynh_script_progression --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" +ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES diff --git a/scripts/restore b/scripts/restore index cca969e..3e1b9ff 100644 --- a/scripts/restore +++ b/scripts/restore @@ -51,7 +51,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." +ynh_script_progression --message="Restoring the NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -116,7 +116,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" #================================================= # CREATE LDAP USER diff --git a/scripts/upgrade b/scripts/upgrade index 067c4cb..7ba8e5d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,6 +33,29 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -74,29 +97,6 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # Restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." - -ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" - #================================================= # CREATE DEDICATED USER #================================================= @@ -192,7 +192,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" #================================================= # RELOAD NGINX From aa86c664d6bb43e4686cc985ff04b9a1758b88c4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 13 May 2021 22:19:32 +0200 Subject: [PATCH 07/10] Apply example_ynh --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 4eff355..912ea63 100644 --- a/scripts/install +++ b/scripts/install @@ -72,7 +72,7 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER diff --git a/scripts/restore b/scripts/restore index 3e1b9ff..04b4189 100644 --- a/scripts/restore +++ b/scripts/restore @@ -84,7 +84,7 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 7ba8e5d..6d3f1bc 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -156,7 +156,7 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_use_nodejs -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # SPECIFIC UPGRADE From f69855a45a5be95146a6ee85142bb3b02e826c6a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 13 May 2021 22:26:00 +0200 Subject: [PATCH 08/10] Apply example_ynh --- scripts/install | 2 +- scripts/upgrade | 4 ++-- scripts/ynh_send_readme_to_admin__2 | 19 +------------------ 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/scripts/install b/scripts/install index 912ea63..56a5641 100644 --- a/scripts/install +++ b/scripts/install @@ -129,7 +129,7 @@ yunohost user create $ldap_user --firstname "SvcWikijsLdap" --lastname "SvcWikij #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a config file..." +ynh_script_progression --message="Adding a configuration file..." ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml" diff --git a/scripts/upgrade b/scripts/upgrade index 6d3f1bc..a5de008 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,7 +54,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service" #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -163,7 +163,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a config file..." +ynh_script_progression --message="Updating a configuration file..." ynh_add_config --template="../conf/config.sample.yml" --destination="$final_path/config.yml" diff --git a/scripts/ynh_send_readme_to_admin__2 b/scripts/ynh_send_readme_to_admin__2 index 06cff8c..8b1edf1 100644 --- a/scripts/ynh_send_readme_to_admin__2 +++ b/scripts/ynh_send_readme_to_admin__2 @@ -72,17 +72,7 @@ ynh_send_readme_to_admin() { Specific information for the application $app. -$(if [ -n "$app_message" ] -then - cat "$app_message" -else - echo "...No specific information..." -fi) - ---- -Automatic diagnosis data from YunoHost - -__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__" +$(cat "$app_message")" # Store the message into a file for further modifications. echo "$mail_message" > mail_to_send @@ -103,10 +93,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service # Insert url links tags ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "\1" mail_to_send - # Insert pre tags - ynh_replace_string "__PRE_TAG1__" "
" mail_to_send
-		ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
-
 		# Insert finishing HTML tags
 		echo -e "\n\n" >> mail_to_send
 
@@ -115,9 +101,6 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
 		# Remove URL tags
 		ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
 		ynh_replace_string "__URL_TAG2__" ": " mail_to_send
-
-		# Remove PRE tags
-		ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
 	fi
 
 	# Define binary to use for mail command

From b48b9b99677ff71ad6ab4b5206d332bd30893ac9 Mon Sep 17 00:00:00 2001
From: yalh76 
Date: Thu, 13 May 2021 22:26:55 +0200
Subject: [PATCH 09/10] Apply example_ynh

---
 scripts/install | 2 +-
 scripts/upgrade | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/install b/scripts/install
index 56a5641..2261e1c 100644
--- a/scripts/install
+++ b/scripts/install
@@ -142,7 +142,7 @@ chown $app:$app "$final_path/config.yml"
 ynh_script_progression --message="Configuring a systemd service..."
 
 # Create a dedicated systemd config
-ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH"
+ynh_add_systemd_config
 
 #=================================================
 # GENERIC FINALIZATION
diff --git a/scripts/upgrade b/scripts/upgrade
index a5de008..adef6ef 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -176,7 +176,7 @@ chown $app:$app "$final_path/config.yml"
 ynh_script_progression --message="Upgrading systemd configuration..."
 
 # Create a dedicated systemd config
-ynh_add_systemd_config --others_var="ynh_node ynh_node_load_PATH"
+ynh_add_systemd_config
 
 #=================================================
 # GENERIC FINALIZATION

From 92ba9c1db2d89ba45b85c5abe49529234ac27491 Mon Sep 17 00:00:00 2001
From: yalh76 
Date: Thu, 13 May 2021 22:28:26 +0200
Subject: [PATCH 10/10] Update check_process

---
 check_process | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/check_process b/check_process
index 4ef7bd9..977129d 100644
--- a/check_process
+++ b/check_process
@@ -34,6 +34,8 @@
 		upgrade=1	from_commit=3c9ab32ee147ef1f39aff2773fc3be506164d873
 		# 2.5.201~ynh1
 		upgrade=1	from_commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
+		# 2.5.201~ynh2
+		upgrade=1	from_commit=17ee20b13ba56babe0231b3f9bd87e9118908838
 		backup_restore=1
 		multi_instance=1
 		port_already_use=0
@@ -66,3 +68,5 @@ Notification=yes
 		name=2.5.197~ynh1
 	; commit=bce2bfa3f9f0e28ffdde79df17a34bd5302559ea
 		name=2.5.201~ynh1
+	; commit=17ee20b13ba56babe0231b3f9bd87e9118908838
+		name=2.5.201~ynh2