|
|
BRACKET=$'\e[34;01m' | BRACKET=$'\e[34;01m' |
fi | fi |
| |
|
# void emergemail(char *severity, char *message) |
|
# |
|
# send mail to root with the given message (if possible) |
|
# severity is either "information" (for einfo), |
|
# "warning" (for ewarn), |
|
# or "error" (for eerror). |
|
# |
|
emergemail() { |
|
SEVERITY=$1 |
|
MESSAGE=$2 |
|
if echo ${FEATURES} | grep -iq emergemail; then |
|
if [ -x /usr/sbin/sendmail ]; then |
|
echo -e "Subject: ${SEVERITY} from emerge of ${P}\n\n${MESSAGE}" \ |
|
| /usr/sbin/sendmail root |
|
else |
|
# don't you dare try to use ewarn here :) |
|
echo -e " ${WARN}*${NORMAL} the emergemail feature was unable to" |
|
echo -e " ${WARN}*${NORMAL} find /usr/sbin/sendmail. You must have" |
|
echo -e " ${WARN}*${NORMAL} a Mail Transfer Agent (MTA) such as" |
|
echo -e " ${WARN}*${NORMAL} postfix, exim, ssmtp, etc. to use this" |
|
echo -e " ${WARN}*${NORMAL} feature." |
|
fi |
|
fi |
|
} |
|
|
# void esyslog(char* priority, char* tag, char* message) | # void esyslog(char* priority, char* tag, char* message) |
# | # |
# use the system logger to log a message | # use the system logger to log a message |
|
|
echo -e " ${GOOD}*${NORMAL} ${*}" | echo -e " ${GOOD}*${NORMAL} ${*}" |
fi | fi |
| |
|
emergemail information "${*}" |
|
|
return 0 | return 0 |
} | } |
| |
|
|
echo -ne " ${GOOD}*${NORMAL} ${*}" | echo -ne " ${GOOD}*${NORMAL} ${*}" |
fi | fi |
| |
|
emergemail information "${*}" |
|
|
return 0 | return 0 |
} | } |
| |
|
|
echo -e " ${WARN}*${NORMAL} ${*}" | echo -e " ${WARN}*${NORMAL} ${*}" |
fi | fi |
| |
|
emergemail warning "${*}" |
|
|
# Log warnings to system log | # Log warnings to system log |
esyslog "daemon.warning" "rc-scripts" "${*}" | esyslog "daemon.warning" "rc-scripts" "${*}" |
| |
|
|
echo -e " ${BAD}*${NORMAL} ${*}" | echo -e " ${BAD}*${NORMAL} ${*}" |
fi | fi |
| |
|
emergemail error "${*}" |
|
|
# Log errors to system log | # Log errors to system log |
esyslog "daemon.err" "rc-scripts" "${*}" | esyslog "daemon.err" "rc-scripts" "${*}" |
| |