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 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..36f03b7 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 @@ -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 7335c47..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 @@ -258,7 +261,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 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