diff --git a/conf/message b/conf/msg_install similarity index 100% rename from conf/message rename to conf/msg_install diff --git a/scripts/install b/scripts/install index 2f98459..cadeea8 100644 --- a/scripts/install +++ b/scripts/install @@ -217,8 +217,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" --destination="../conf/msg_install" - ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients="$admin_mail" --type='install' #================================================= diff --git a/scripts/ynh_send_readme_to_admin__2 b/scripts/ynh_send_readme_to_admin__2 index fc329d3..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= ) @@ -23,7 +25,7 @@ ynh_send_readme_to_admin() { type="${type:-install}" # Get the value of admin_mail_html - admin_mail_html=$(ynh_app_setting_get "$app" admin_mail_html) + admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) admin_mail_html="${admin_mail_html:-0}" # Retrieve the email of users @@ -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