Mark wrote:
Hi Roy, I wasn't able to find it. Can you post your version? This
sounds like the approach I'd like to take. Thanks!
Here it is. After reading Matt's post, looks like I need to try
dispatch-conf instead of etc-update. Learn something new
everyday here. ;-)
Disclaimor, these scripts are starting points. Customization
is highly recommended. :-)
Scripts:
/etc/cron.daily/portage.cron
/usr/local/sbin/einfo
Have fun,
Roy
#!/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
#!/usr/bin/perl
# this script will run emerge with the given command line options plus
# "--pretend". It will then grep all of the packages to be merged looking
# for einfo, ewarn, and eerror lines to display.
# Thanks to [EMAIL PROTECTED] for the ewarn and error suggestions.
$portage = '/usr/portage';
$emerge = "emerge @ARGV --pretend";
open(EMERGE, "$emerge|") || die "unable to open $emerge\n";
while(<EMERGE>) {
if(/\[[^\]]+\]\s+(\S+)\/(\S+)\-(\d\S*)\s/) {
findInfo($1,$2,$3);
}
}
close(EMERGE);
exit 0;
sub findInfo
{
local ($package,$name,$ver) = @_;
local $pkgDir = "$portage/$package/$name";
local $ebuild = "$pkgDir/$name-$ver.ebuild";
print "$ebuild\n";
if(-T $ebuild) {
open(EBUILD, "<$ebuild") || warn "unable to read $ebuild\n";
while(<EBUILD>) {
if(/(einfo.*)$/) {
print " $1\n";
}
if(/(ewarn.*)$/) {
print " $1\n";
}
if(/(eerror.*)$/) {
print " $1\n";
}
}
close(EBUILD);
}
print "\n";
}