Version courante

This commit is contained in:
Alarig Le Lay 2018-04-08 17:28:42 +02:00
parent e2019919bc
commit dc2b0a5eb6

32
check_updates.sh Executable file
View file

@ -0,0 +1,32 @@
#!/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}