Merge remote-tracking branch 'origin/feature-mail-optional' into develop

This commit is contained in:
6543 2018-05-19 22:30:40 +02:00
commit 1d52508d77

View File

@ -4,28 +4,31 @@


#on_exit [error_level] #on_exit [error_level]
function on_exit() { function on_exit() {
#send log and errorlevel[success/errorr xy] ### send mail
[ -n "$log_mail_aim" ] && {
#send log and errorlevel[success/errorr xy]
if [ "$1" != "0" ]; then
log_mail_subject="$log_mail_subject [ERROR]"
else
log_mail_subject="$log_mail_subject [Success]"
fi


if [ "$1" != "0" ]; then #Mail Body:
log_mail_subject="$log_mail_subject [ERROR]" for mail_aim in `echo "$log_mail_aim" | tr "," " "`; do
else {
log_mail_subject="$log_mail_subject [Success]" echo "$log_mail_subject"
fi echo $'####################################################################################\n\n'
cat "$log_file"
} | sendemail -s "$log_mail_smtp" -f "$log_mail_source" -t "$mail_aim" -u "$log_mail_subject" -o tls=no
done
}


#Mail Body: ### clean up
for mail_aim in `echo "$log_mail_aim" | tr "," " "`; do [ "$1" != "0" ] && {
{ chroot_umount$distro "$chroot_path" 2> /dev/null
echo "$log_mail_subject" workspace_erase "$iso_extr_dir/" "$chroot_path/" 2> /dev/null
echo $'####################################################################################\n\n' }
cat "$log_file" exit $1
} | sendemail -s "$log_mail_smtp" -f "$log_mail_source" -t "$mail_aim" -u "$log_mail_subject" -o tls=no
done

[ "$1" != "0" ] && {
chroot_umount$distro "$chroot_path" 2> /dev/null
workspace_erase "$iso_extr_dir/" "$chroot_path/" 2> /dev/null
}
exit $1
} }


#this func is standalone executable #this func is standalone executable