33 lines
821 B
Bash
Executable file
33 lines
821 B
Bash
Executable file
#!/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}
|
|
|
|
emerge -v --update --newuse --deep --with-bdeps=y --quiet-build=1 @world \\
|
|
&>> ${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}
|