RedHat Network redux
Eric Johnson
ej@netasm.com
Fri, 13 Oct 2000 11:58:01 -0700 (MST)
I just coded up the following to check for RH 6.2 updates; I've been
meaning to do this for a while.
I'm sure this idea can be extended to get the latest updates from your
favorite mirror, etc. All I really wanted here was notification regarding
new security issues with 6.2.
Yes Hans, I know Debian's apt-get is much more elegant than this :-)
Any comments or suggestion, fire away.
--Eric
---
Eric Johnson (ej@netasm.com) net.assembly
http://netasm.com/ 12629 North Tatum Boulevard #191
602 996-9682 Phoenix, Arizona 85032
#!/bin/bash
export PATH=/bin:/usr/bin
LOCALDIR=/usr/local/src/redhat-6.x
SENDALL=0
ERRATAPAGE='rh62-errata-security.html'
ERRATAURL="http://www.redhat.com/support/errata/$ERRATAPAGE"
MAIL='/var/qmail/bin/qmail-inject ej@netasm.com'
die () {
echo "$*"
exit 1
}
cd $LOCALDIR || die could not cd $LOCALDIR
rm -f $ERRATAPAGE
wget -q $ERRATAURL || die wget failed to get $ERRATAURL
if [ -f errata.txt ]; then
mv errata.txt errata.txt-prev || die mv errata.txt failed
else
# no previous version to diff; send *all* errata to admin
SENDALL=1
fi
lynx -dump $ERRATAPAGE | grep RHSA | grep -v /localhost/ > errata.txt
if [ $SENDALL = 1 ]; then
cat errata.txt | $MAIL
exit 0
fi
diff -c errata.txt-prev errata.txt | grep ^+ > errata.diffs
[ -s errata.diffs ] && cat errata.diffs | $MAIL
exit 0