2018-04-08 17:28:42 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
PATH="$PATH:/usr/sbin:/sbin"
|
|
|
|
TERM=vt100
|
|
|
|
|
|
|
|
TMP_FILE=$(mktemp)
|
|
|
|
MAIL=$(mktemp)
|
|
|
|
|
|
|
|
PORTAGE_QUIET='1'
|
|
|
|
|
|
|
|
eix-sync 1>/dev/null 2>${TMP_FILE}
|
|
|
|
|
2018-04-09 07:58:09 +02:00
|
|
|
emerge -v --update --newuse --deep --with-bdeps=y --quiet-build=y @world \\
|
2018-04-08 17:28:42 +02:00
|
|
|
&>> ${TMP_FILE}
|
|
|
|
|
|
|
|
if [ "$(grep '\[ebuild U' ${TMP_FILE})" != '' ]; then
|
|
|
|
echo "From: $(whoami)@$(hostname -f)" > ${MAIL}
|
|
|
|
echo "To: root@$(hostname -f)" >> ${MAIL}
|
|
|
|
echo "Subject: $(hostname -f):$(grep Total: ${TMP_FILE} \
|
|
|
|
| cut -d ':' -f 2 | cut -d ')' -f 1))" >> ${MAIL}
|
|
|
|
echo "Content-Type: text/plain; charset=UTF-8" >> ${MAIL}
|
|
|
|
cat ${TMP_FILE} >> ${MAIL}
|
|
|
|
|
|
|
|
if [ "$(lsof -n | awk '{ if ($5 == "DEL") print $9 }' | sort -u)" ]; then
|
|
|
|
restart_services -u >> ${MAIL}
|
|
|
|
fi
|
|
|
|
emerge -p --depclean --with-bdeps\=y >> ${MAIL}
|
|
|
|
|
|
|
|
cat ${MAIL} | sendmail -t root@$(hostname -f)
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm ${TMP_FILE} ${MAIL}
|