From a5d0da7c4e33cd15e521ebf6e75d9f8acd93ae7b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Tue, 10 Jul 2018 23:57:27 +0200 Subject: [PATCH] upgrade ynh_send_readme_to_admin helper if mail binary isn't properly selected, it may create an infinite loop at install --- scripts/_common.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2ec6a78..52f91d6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -287,14 +287,26 @@ 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 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" } # Exit without error if the package is up to date