From 516d9279744ef7f14f885d9b51ce19e6db07b966 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 3 Jun 2018 15:07:35 +0200 Subject: [PATCH] Impove mail helper and check_process --- check_process | 7 +++---- scripts/_common.sh | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/check_process b/check_process index f996816..dce862c 100644 --- a/check_process +++ b/check_process @@ -19,8 +19,7 @@ setup_private=1 setup_public=1 upgrade=1 - # latest published in community.json - upgrade=1 from_commit=dc037965b0fbc1bd59d352c4d2b71a97b1e4768f + upgrade=1 from_commit=f2c1f14df484d727f1918821b6ade3887f77ec40 backup_restore=1 multi_instance=1 incorrect_path=1 @@ -43,6 +42,6 @@ Email=jean-baptiste@holcroft.fr Notification=all ;;; Upgrade options - ; commit=dc037965b0fbc1bd59d352c4d2b71a97b1e4768f - name=Upgrade from 2.17.1 + ; commit=f2c1f14df484d727f1918821b6ade3887f77ec40 + name=Upgrade from 2.20 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake diff --git a/scripts/_common.sh b/scripts/_common.sh index c8dfa70..5a0f3b4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -285,7 +285,7 @@ ynh_psql_drop_user() { # 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" ynh_send_readme_to_admin() { - local app_message="${1:-...No specific informations...}" + local app_message="${1:-...No specific information...}" local recipients="${2:-root}" # Retrieve the email of users @@ -315,12 +315,24 @@ ynh_send_readme_to_admin() { local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!" local mail_message="This is an automated message from your beloved YunoHost server. -Specific informations for the application $app. + +Specific information for the application $app. + $app_message + --- Automatic diagnosis data from YunoHost + $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" + # Define binary to use for mail command + if [ -e /usr/bin/bsd-mailx ] + then + local mail_bin=/usr/bin/bsd-mailx + else + local mail_bin=/usr/bin/mail.mailutils + fi + # Send the email to the recipients - echo "$mail_message" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" + echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" }