Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 11359 | Differences between
and this patch

Collapse All | Expand All

(-)functions-old.sh (+33 lines)
Lines 121-126 Link Here
121
	BRACKET=$'\e[34;01m'
121
	BRACKET=$'\e[34;01m'
122
fi
122
fi
123
123
124
# void emergemail(char *severity, char *message)
125
#
126
#	send mail to root with the given message (if possible)
127
#	severity is either "information" (for einfo),
128
#					   "warning" (for ewarn),
129
#					or "error" (for eerror).
130
#
131
emergemail() {
132
	SEVERITY=$1
133
	MESSAGE=$2
134
	if echo ${FEATURES} | grep -iq emergemail; then
135
		if [ -x /usr/sbin/sendmail ]; then
136
			echo -e "Subject: ${SEVERITY} from emerge of ${P}\n\n${MESSAGE}" \
137
						| /usr/sbin/sendmail root 
138
		else
139
			# don't you dare try to use ewarn here :)
140
			echo -e " ${WARN}*${NORMAL} the emergemail feature was unable to"
141
			echo -e " ${WARN}*${NORMAL} find /usr/sbin/sendmail.  You must have"
142
			echo -e " ${WARN}*${NORMAL} a Mail Transfer Agent (MTA) such as"
143
			echo -e " ${WARN}*${NORMAL} postfix, exim, ssmtp, etc. to use this"
144
			echo -e " ${WARN}*${NORMAL} feature."
145
		fi
146
	fi
147
}
148
124
# void esyslog(char* priority, char* tag, char* message)
149
# void esyslog(char* priority, char* tag, char* message)
125
#
150
#
126
#    use the system logger to log a message
151
#    use the system logger to log a message
Lines 153-158 Link Here
153
		echo -e " ${GOOD}*${NORMAL} ${*}"
178
		echo -e " ${GOOD}*${NORMAL} ${*}"
154
	fi
179
	fi
155
180
181
	emergemail information "${*}"
182
156
	return 0
183
	return 0
157
}
184
}
158
185
Lines 166-171 Link Here
166
		echo -ne " ${GOOD}*${NORMAL} ${*}"
193
		echo -ne " ${GOOD}*${NORMAL} ${*}"
167
	fi
194
	fi
168
195
196
	emergemail information "${*}"
197
169
	return 0
198
	return 0
170
}
199
}
171
200
Lines 181-186 Link Here
181
		echo -e " ${WARN}*${NORMAL} ${*}"
210
		echo -e " ${WARN}*${NORMAL} ${*}"
182
	fi
211
	fi
183
212
213
	emergemail warning "${*}"
214
184
	# Log warnings to system log
215
	# Log warnings to system log
185
	esyslog "daemon.warning" "rc-scripts" "${*}"
216
	esyslog "daemon.warning" "rc-scripts" "${*}"
186
217
Lines 199-204 Link Here
199
		echo -e " ${BAD}*${NORMAL} ${*}"
230
		echo -e " ${BAD}*${NORMAL} ${*}"
200
	fi
231
	fi
201
232
233
	emergemail error "${*}"
234
202
	# Log errors to system log
235
	# Log errors to system log
203
	esyslog "daemon.err" "rc-scripts" "${*}"
236
	esyslog "daemon.err" "rc-scripts" "${*}"
204
237

Return to bug 11359