From 07dd5a839ebb322ef33fcb83f8e4a10521db327e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 13 May 2021 22:41:53 +0200 Subject: [PATCH 1/3] remove others_var --- manifest.json | 2 +- scripts/install | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 071f03e..3fcc55f 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ } ], "requirements": { - "yunohost": ">= 4.1.7.3" + "yunohost": ">= 4.2.0" }, "multi_instance": false, "services": [ diff --git a/scripts/install b/scripts/install index a416115..ac5a919 100644 --- a/scripts/install +++ b/scripts/install @@ -187,7 +187,7 @@ chown $app:$app "$final_path/config/local-production.json" 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 #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 7335c47..fb026ff 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -258,7 +258,7 @@ popd 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 730510ef71da122d33ed5c0c27b0a73d91ecd87a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 14 May 2021 00:14:17 +0200 Subject: [PATCH 2/3] Update ynh_send_readme_to_admin --- scripts/install | 1 - scripts/remove | 1 - scripts/upgrade | 3 +++ scripts/ynh_send_readme_to_admin__2 | 25 +++++++------------------ 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/scripts/install b/scripts/install index ac5a919..36f03b7 100644 --- a/scripts/install +++ b/scripts/install @@ -275,7 +275,6 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= ynh_script_progression --message="Sending a readme for the admin..." -ynh_add_config --template="../conf/message_install" --destination="../conf/msg_install" ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install' #================================================= diff --git a/scripts/remove b/scripts/remove index 8149dd4..318ce53 100644 --- a/scripts/remove +++ b/scripts/remove @@ -121,7 +121,6 @@ ynh_system_user_delete --username=$app #================================================= ynh_script_progression --message="Sending a readme for the admin..." -ynh_add_config --template="../conf/message_remove" --destination="../conf/msg_remove" ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove' #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fb026ff..a307da6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,6 +76,9 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab ynh_secure_remove --file="/etc/apt/sources.list.d/jessie-backports.list" ynh_secure_remove --file="/etc/apt/sources.list.d/yarn.list" +# Remove not needed checksum +ynh_delete_file_checksum --file="../conf/msg_install" + if [ -z "$rtmp_port" ]; then rtmp_port=1935 diff --git a/scripts/ynh_send_readme_to_admin__2 b/scripts/ynh_send_readme_to_admin__2 index 06cff8c..ee571cc 100644 --- a/scripts/ynh_send_readme_to_admin__2 +++ b/scripts/ynh_send_readme_to_admin__2 @@ -9,6 +9,8 @@ # If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you # example: "root admin@domain user1 user2" # | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade' +# +# Requires YunoHost version 4.1.0 or higher. ynh_send_readme_to_admin() { # Declare an array to define the options of this helper. declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= ) @@ -68,21 +70,15 @@ ynh_send_readme_to_admin() { mail_subject="$mail_subject has just been installed!" fi + ynh_add_config --template="$app_message" --destination="../conf/msg__to_send" + + ynh_delete_file_checksum --file="../conf/msg__to_send" + local mail_message="This is an automated message from your beloved YunoHost server. 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 "../conf/msg__to_send")" # Store the message into a file for further modifications. echo "$mail_message" > mail_to_send @@ -103,10 +99,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 +107,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 10cb98613bce20c9e0aa38250839ff364dceb193 Mon Sep 17 00:00:00 2001
From: yalh76 
Date: Fri, 14 May 2021 00:24:59 +0200
Subject: [PATCH 3/3] Fix messages

---
 conf/{message_install => msg_install} | 0
 conf/{message_remove => msg_remove}   | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename conf/{message_install => msg_install} (100%)
 rename conf/{message_remove => msg_remove} (100%)

diff --git a/conf/message_install b/conf/msg_install
similarity index 100%
rename from conf/message_install
rename to conf/msg_install
diff --git a/conf/message_remove b/conf/msg_remove
similarity index 100%
rename from conf/message_remove
rename to conf/msg_remove