1
0
Fork 0
forked from mirrors/openup

Implement binpatch support in cron (-c) mode.

This finishes the initial implementation of openup...
This commit is contained in:
Antoine Jacoutot 2013-09-03 11:46:28 +02:00
commit f68e518450

23
openup
View file

@ -181,23 +181,32 @@ update_pkg() {
# this only outputs the most recent vulnerability for each pkg
check_vuxml() {
local _OUTDATED
local _BP _BP_OUTDATED _PKG_OUTDATED
ftp -Vo ${_TMPVUXML} ${VUXML_URL} >/dev/null
perl -pi -e 's,\$ARCH,'"$(arch -s)"',g' ${_TMPVUXML}
_OUTDATED=$(pkg_add -nuv -D nosig 2>/dev/null | \
grep '(installing)(pretending)' | \
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"')
_BP=$(pkg_info -Q binpatch${_REL_INT}-$(arch -s) | sed 's/.[^-]*$//' | sort -u | tr '\n' ' ')
_BP_OUTDATED=$(pkg_add -nv -D nosig ${_BP} 2>/dev/null | \
grep '^Adding.*(pretending)' | \
sort -u | \
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"')
for p in ${_OUTDATED}
_PKG_OUTDATED=$(pkg_add -nuv -D nosig 2>/dev/null | \
grep '(installing)(pretending)' | \
grep -v binpatch${_REL_INT}-$(arch -s) | \
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"')
for p in ${_BP_OUTDATED} ${_PKG_OUTDATED}
do
pr_bigarrow "${p} <"
# XXX how do we print only the 1st matching range in awk?
awk "/<name>${p}<\/name>/,/<\/vuln>/" ${_TMPVUXML} | \
sed '/<\/vuln>/,$d' | \
sed -n -e 's/.*<range><lt>\(.*\)<\/lt><\/range>.*/\1/p' \
-e 's/.*<p>\(.*\)<\/p>.*/\1/p' | uniq | \
-e 's/.*<p>\(.*\)<\/p>.*/\1/p' | uniq | \
while read l; do echo -n "${l} "; done
echo "\n"
done | fmt | sed '/^$/d'