1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

Impove mail helper and check_process

This commit is contained in:
Jean-Baptiste Holcroft 2018-06-03 15:07:35 +02:00
parent f4907c50cb
commit 516d927974
2 changed files with 18 additions and 7 deletions

View file

@ -19,8 +19,7 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# latest published in community.json upgrade=1 from_commit=f2c1f14df484d727f1918821b6ade3887f77ec40
upgrade=1 from_commit=dc037965b0fbc1bd59d352c4d2b71a97b1e4768f
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1 incorrect_path=1
@ -43,6 +42,6 @@
Email=jean-baptiste@holcroft.fr Email=jean-baptiste@holcroft.fr
Notification=all Notification=all
;;; Upgrade options ;;; Upgrade options
; commit=dc037965b0fbc1bd59d352c4d2b71a97b1e4768f ; commit=f2c1f14df484d727f1918821b6ade3887f77ec40
name=Upgrade from 2.17.1 name=Upgrade from 2.20
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake

View file

@ -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 # 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" # example: "root admin@domain user1 user2"
ynh_send_readme_to_admin() { ynh_send_readme_to_admin() {
local app_message="${1:-...No specific informations...}" local app_message="${1:-...No specific information...}"
local recipients="${2:-root}" local recipients="${2:-root}"
# Retrieve the email of users # Retrieve the email of users
@ -315,12 +315,24 @@ ynh_send_readme_to_admin() {
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!" local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
local mail_message="This is an automated message from your beloved YunoHost server. 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 $app_message
--- ---
Automatic diagnosis data from YunoHost Automatic diagnosis data from YunoHost
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" $(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 # 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"
} }