NetBSD/pkg-audit

From Segfault
Jump to: navigation, search
#!/bin/sh
#
# (c) lists@nerdbynature.de
#
# Use security/audit-packages to print packages that
# need to be updated. Also show where they're located
# in pkgsrc to make updates easier
#
rm -f /tmp/audit.*
if   [ ! -x "`which audit-packages`" ]; then
	echo "Please install security/audit-packages!"
	exit 1

elif [ "$1" = "-d" ]; then
	download-vulnerability-list 1>/dev/null

else
	:
fi

# tempfile
VULN="`mktemp -t audit`"

# fetch with ipv4 only to suppress errors
FETCH_ARGS="-4"

audit-packages | awk '{print $2}' | cut -d \- -f 1 | sort -u > "$VULN"
# echo "Vulnarable packges are now listed in "$VULN""

# find pkgs in the tree
for i in `cat "$VULN"`; do
	ls -d /usr/pkgsrc/*/"$i"
done