forked from mirrors/openup
Optimize the way we check vuxml: we only want to run pkg_add -u against
a list of possible candidates, not all of our packages. This can drasticaly reduce the run in cron mode when lots of packages are installed.
This commit is contained in:
parent
1557b975bd
commit
f63604f746
1 changed files with 7 additions and 2 deletions
9
openup
9
openup
|
|
@ -165,7 +165,7 @@ update_pkg() {
|
||||||
|
|
||||||
# this only outputs the most recent vulnerability for each pkg
|
# this only outputs the most recent vulnerability for each pkg
|
||||||
check_vuxml() {
|
check_vuxml() {
|
||||||
local _BP _BP_OUTDATED _PKG_OUTDATED
|
local _BP _BP_OUTDATED _PAT _PKG_MATCH _PKG_OUTDATED
|
||||||
|
|
||||||
ftp -Vo ${_TMPVUXML} ${VUXML_URL} >/dev/null
|
ftp -Vo ${_TMPVUXML} ${VUXML_URL} >/dev/null
|
||||||
perl -pi -e 's,\$ARCH,'"$(arch -s)"',g' ${_TMPVUXML}
|
perl -pi -e 's,\$ARCH,'"$(arch -s)"',g' ${_TMPVUXML}
|
||||||
|
|
@ -177,7 +177,12 @@ check_vuxml() {
|
||||||
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
|
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
|
||||||
perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"')
|
perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"')
|
||||||
|
|
||||||
_PKG_OUTDATED=$(pkg_add -qnuv -D nosig 2>/dev/null | \
|
_PAT=$(pkg_info -q | perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"' | \
|
||||||
|
while read l ; do echo -n "|$l" ; done | \
|
||||||
|
sed 's/^|//' | sed -e 's,++,\\\++,g')
|
||||||
|
_PKG_MATCH=$(grep -Eo '<name>('"${_PAT}"')</name>' ${_TMPVUXML} | \
|
||||||
|
sort -u | sed -e 's,<name>,,g;s,</name>,,g')
|
||||||
|
_PKG_OUTDATED=$(pkg_add -qnuv -D nosig ${_PKG_MATCH} 2>/dev/null | \
|
||||||
grep '(installing)(pretending)' | \
|
grep '(installing)(pretending)' | \
|
||||||
grep -v binpatch${_REL_INT}-$(arch -s) | \
|
grep -v binpatch${_REL_INT}-$(arch -s) | \
|
||||||
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
|
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue