Commit 2a95ce00 authored by Marcus Nordenberg's avatar Marcus Nordenberg Committed by Esteban Blanc

Add pwr_mailto wrapper to pwrrt package

* Change default email command of PostConfig
* Add pwr_mailto wrapper for sending emails/sms
* Include pwr_mailto in pwrrt package

(cherry picked from commit 586ac7750947ca2c1a15fba14efa60b3ef949133)
parent b0ee2d93
......@@ -148,19 +148,12 @@ gzip -fq --best $pkgroot/usr/share/man/man1/rt_rtt.1
# Copy proview
mkdir $pkgroot/usr/pwrrt
#currentdir="`eval pwd`"
#tarfile=$pwre_broot/$pwre_target/bld/pkg/pwrtmp.tar
#cd $pwre_broot/$pwre_target/exp
echo "-- Copy release to package tree"
cp -r $pwre_broot/$pwre_target/exp/* $pkgroot/usr/pwrrt/
##tar -cf $tarfile *
#cd $pkgroot/usr/pwrrt
#tar -xf $tarfile
#rm $tarfile
rm -r $pkgroot/usr/pwrrt/lib/*.a
rm -r $pkgroot/usr/pwrrt/exe/wb*
cp $pwr_eexe/wb_distr_keepboot.sh $pkgroot/usr/pwrrt/exe
#cd $currentdir
cp $pkgsrc/pwr_mailto $pkgroot/usr/pwrrt/exe/
# Copy configuration files to cnf
cp $pkgsrc/proview.cnf $pkgroot/usr/pwrrt/cnf
......
#!/bin/bash
# To use this you need an MTA installed. This particular script uses sendmail "syntax".
# If you want it up and running quickly a simple MTA that we (at SSAB) use, is msmtp.
# It's still available in buster. It uses sendmail syntax aswell...
# If another MTA is used you need to update this script accordingly or change the
# sms/email command attribute of the PostConfig object in ProviewR.
# Regarding msmtp:
# By default, mails are sent in a 'fire and forget' manner. If you need msmtp to actually
# wait for a delivery status notification (DSN) you need to set this up aswell in the
# msmtp. The lines:
# dsn_notify failure
# dsn_return headers
# Are in most cases sufficient for a simple propagation of the status code back to ProviewR.
# These features will block while waiting for the DSN to arrive, therefore ProviewR call
# sms/email command asynchronous, checking the status of the calls every now and then...
# Arguments should be quoted
# Simple argument count control...
[[ ${#} -ne 4 ]] && exit 1
MESSAGE="${4}"
SENDMAIL=/usr/bin/msmtp
${SENDMAIL} -t -- << EOF
From: ${1}
To: ${2}
Subject: ${3}
${MESSAGE}
EOF
# Do not add more commands here since we need the exit code from "sendmail". If you need
# to do more things please exit the shell with an appropriate exit code to reflect the
# actual status of the command that sent the mail :)
......@@ -193,7 +193,7 @@ SObject pwrb:Class
EndObject
Object Template PostConfig
Body RtBody
Attr EmailCmd = "mailto 'ProviewR' '$address' 'ProviewR alarm' '$text'"
Attr EmailCmd = "pwr_mailto 'ProviewR' '$address' 'ProviewR alarm' '$text'"
EndBody
EndObject
EndObject
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment