little script checking for installed packages in WNPP
Hi
Figured this could reduce the amount of packages on wnpp. It
sends root mail when it sees an installed package marked as
orphaned or up for adoption on WNPP. Crude little quick'n'dirty
type thing.
ciao, 2ri
--
No, I'm not going to explain it. If you can't figure it out, you didn't
want to know anyway... :-)
-- Larry Wall in <1991Aug7.180856.2854@netlabs.com>
#! /bin/sh -e
# wnppalert -- check for orphaned or put up for adoption, installed packages
# get a list of packages with bugnumbers. I tried with LDAP, but this is _much_
# faster
INSTALLED=`mktemp ${TMPDIR:-/tmp}/wnppalert-installed.XXXXXX`
WNPP=`mktemp ${TMPDIR:-/tmp}/wnppalert-wnpp.XXXXXX`
WNPP_PACKAGES=`mktemp ${TMPDIR:-/tmp}/wnppalert-wnpp_packages.XXXXXX`
wget -O - http://www.debian.org/devel/wnpp/orphaned| \
egrep '^<li><a href="http://bugs.debian.org/'| \
sed 's/<li><a href="http:\/\/bugs.debian.org\/\([0-9]*\)">\([^:]*\): \(.*\)<\/a>/O \1 \2 -- \3/'\
> $WNPP
wget -O - http://www.debian.org/devel/wnpp/rfa_bypackage| \
egrep '^<li><a href="http://bugs.debian.org/'| \
sed 's/<li><a href="http:\/\/bugs.debian.org\/\([0-9]*\)">\([^:]*\): \(.*\)<\/a>/RFA \1 \2 -- \3/'\
>> $WNPP
cut -f3 -d' ' $WNPP | sort > $WNPP_PACKAGES
# A list of installed files. This shouldn't use /var/lib/dpkg/status directly, but speed ...
grep -B1 'Status: install ok installed' /var/lib/dpkg/status| \
grep Package| \
cut -f2 -d' '| \
sort \
> $INSTALLED
(
egrep "`comm -12 $WNPP_PACKAGES $INSTALLED | tr "\n" \|`IDontMatchAnything" $WNPP
echo
echo "Yours obediently, $0"
) | mail -s "Packages installed on $HOSTNAME appear on WNPP" root
rm $WNPP $WNPP_PACKAGES $INSTALLED
Reply to: