#!/bin/sh # # Remove downloads older than 14 days # Remove directories from /var/tmp/portage older than 2 days # Remove ._mrg* files left over from dispatch-conf # Sync the portage tree # Update the database used by esearch # See what would be updated and estimate how long # Depends on cron to mail results to root # # Dependencies: # >=sys-apps/portage-2.0.51 # >=app-portage/gentoolkit-0.2.1_pre3 # app-portage/esearch # app-portage/genlop # app-admin/tmpwatch #echo "Portage Tree not Updated"; exit 0 export PATH=$PATH:/usr/sbin export NOCOLOR="true" # Turn off color for "emerge" echo "Starting portage.cron at: $(date)" >> /var/log/portage.cron.log #echo "Finding and cleaning older distfiles..." #tmpwatch --atime --mtime --ctime --verbose 168 /usr/portage/distfiles echo "Cleaning /var/tmp/portage..." #tmpwatch --atime --mtime --ctime --verbose 48 --exclude /var/tmp/portage/homedir /var/tmp/portage tmpwatch --atime --mtime --ctime 48 --exclude /var/tmp/portage/homedir /var/tmp/portage echo "Cleaning up old merge files from dispatch-conf" find / -xdev -name "._mrg*" -exec rm {} \; echo "Running revdep-rebuild" revdep-rebuild --ignore --pretend --no-color rm -f /.revdep-rebuild.* echo "Syncing portage tree..." emerge --sync 2>> /var/log/portage.cron.log > /dev/null status=$? if [ $status -ne 0 ]; then echo "Portage sync failed, exiting update." exit $status fi echo "Running eupdatedb..." eupdatedb --quiet --nocolor 2> /dev/null echo "Running update-eix..." update-eix --quiet echo "Checking for updates..." /usr/local/sbin/einfo --update --deep --newuse world emerge --update --deep --pretend --verbose --nospinner --newuse world > /tmp/emerge.output emerge --update --deep --fetchonly --quiet --nospinner --newuse world >> /tmp/emerge.output echo "Estimated time for updates..." cat /tmp/emerge.output | genlop -n --pretend rm -f /tmp/emerge.output echo "Checking Gentoo Linux Security Advisories (GLSA) ..." for glsa in `glsa-check -t all 2>/dev/null | grep -v GLSA` do glsa-check --pretend $glsa 2>/dev/null glsa-check --print $glsa 2>/dev/null done