#anacron

felix@pod.pc-tiede.de

For those who manage more than one #Gentoo⁠-based workstation, here's a little #script to avoid manually figuring out the list of outstanding updates every other day.

#!/bin/bash

# Check for updates

KERNELFLAVOR="" # Potentially "gentoo" or "vanilla" or any other available flavor

LOGFILE="$(mktemp -t updates_log.XXXXXXXXXX)"

emerge --sync 2>${LOGFILE} >/dev/null
if [ $? -ne 0 ]; then
    logger "Package tree synchronization has failed"
    exit 1
fi

emerge world -uDNtp --with-bdeps=y --nospinner >> ${LOGFILE}
glsa-check -t new 2>/dev/null >> ${LOGFILE}

emerge -1uq --nospinner ${KERNELFLAVOR}-sources >> ${LOGFILE}

[ $(cat ${LOGFILE} | wc -l) -gt 4 ] && \
    mail -s "Available Updates for $(hostname)" root < ${LOGFILE}
rm -f ${LOGFILE}

# End of script

If this script is run by #anacron on a daily or weekly basis, there is of course a privacy concern, as the script reports in whenever the system becomes available. However, this is reduced by the script only sending a mail if there actually are updates available.

@Rebeka Catalina