forked from mirrors/openup
Implement exclusion list.
Adding packages and/or binpatches to EXCLUDE_PKG will make openup skip them.
This commit is contained in:
parent
8ec7c9d161
commit
26ad7b8f67
1 changed files with 35 additions and 13 deletions
48
openup
48
openup
|
|
@ -38,6 +38,8 @@ PKG_PATH_MAIN="http://ftp.fr.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(arch
|
||||||
PKG_PATH_UPDATE="https://stable.mtier.org/updates/$(uname -r)/$(arch -s)"
|
PKG_PATH_UPDATE="https://stable.mtier.org/updates/$(uname -r)/$(arch -s)"
|
||||||
# URL to the latest vuxml (vulnerabilities database)
|
# URL to the latest vuxml (vulnerabilities database)
|
||||||
VUXML_URL="https://stable.mtier.org/vuxml/${_REL_INT}.xml"
|
VUXML_URL="https://stable.mtier.org/vuxml/${_REL_INT}.xml"
|
||||||
|
# exclusion list: pkg names without version/flavor, separated by space
|
||||||
|
EXCLUDE_PKG=""
|
||||||
########################################################################
|
########################################################################
|
||||||
### End of user defined variables ###
|
### End of user defined variables ###
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
@ -186,14 +188,17 @@ rm_old_bp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
update_binpatches() {
|
update_binpatches() {
|
||||||
local _BP _CMD
|
local _BP _CMD _b _e
|
||||||
|
|
||||||
_BP=$(pkg_info -Q binpatch${_REL_INT}-${_ARCH} | sed 's/.[^-]*$//' | sort -u | tr '\n' ' ')
|
_BP=$(pkg_info -Q binpatch${_REL_INT}-${_ARCH} | sed 's/.[^-]*$//' | sort -u)
|
||||||
|
|
||||||
if [ -n "${_BP}" ]; then
|
if [ -n "${_BP}" ]; then
|
||||||
if [ -n "${exclude_kernel}" ]; then
|
for _e in ${EXCLUDE_PKG}; do
|
||||||
_BP=$(echo ${_BP} | sed -e "s,binpatch${_REL_INT}-${_ARCH}-kernel,,g")
|
set -A _BP -- ${_BP}
|
||||||
fi
|
_BP="$(for _b in ${_BP[@]}; do echo ${_b} | grep -v "^${_e}$"; done)"
|
||||||
|
done
|
||||||
|
_BP=$(echo "${_BP}" | tr '\n' ' ')
|
||||||
|
|
||||||
pr_bigarrow "Installing/updating binpatch(es)"
|
pr_bigarrow "Installing/updating binpatch(es)"
|
||||||
_CMD="pkg_add ${pkg_opt} ${_BP}"
|
_CMD="pkg_add ${pkg_opt} ${_BP}"
|
||||||
pr_smallarrow "${_CMD}"
|
pr_smallarrow "${_CMD}"
|
||||||
|
|
@ -202,11 +207,17 @@ update_binpatches() {
|
||||||
}
|
}
|
||||||
|
|
||||||
update_pkg() {
|
update_pkg() {
|
||||||
local _CMD _PKG
|
local _CMD _PKG _e _p
|
||||||
|
|
||||||
_PKG=$(pkg_info -q | grep -v binpatch${_REL_INT}-${_ARCH})
|
_PKG=$(pkg_info -q | grep -v binpatch${_REL_INT}-${_ARCH})
|
||||||
|
|
||||||
if [ -n "${_PKG}" ]; then
|
if [ -n "${_PKG}" ]; then
|
||||||
|
for _e in ${EXCLUDE_PKG}; do
|
||||||
|
set -A _PKG -- ${_PKG}
|
||||||
|
_PKG="$(for _p in ${_PKG[@]}; do echo ${_p} | grep -v "^${_e}-.*"; done)"
|
||||||
|
done
|
||||||
|
_PKG=$(echo "${_PKG}" | tr '\n' ' ')
|
||||||
|
|
||||||
pr_bigarrow "Updating package(s)"
|
pr_bigarrow "Updating package(s)"
|
||||||
_CMD="pkg_add -quz ${pkg_opt}"
|
_CMD="pkg_add -quz ${pkg_opt}"
|
||||||
# we don't want to display ${_PKG}, there could be hundreds
|
# we don't want to display ${_PKG}, there could be hundreds
|
||||||
|
|
@ -218,16 +229,16 @@ update_pkg() {
|
||||||
|
|
||||||
# this only outputs the most recent vulnerability for each matching pkg
|
# this only outputs the most recent vulnerability for each matching pkg
|
||||||
check_vuxml() {
|
check_vuxml() {
|
||||||
local _BP_MATCH _OUTDATED _PAT _PKG_MATCH
|
local _BP_MATCH _OUTDATED _PAT _PKG_MATCH _b _e _p
|
||||||
|
|
||||||
ftp -Vo ${_TMPVUXML} ${VUXML_URL} >/dev/null || exit 1
|
ftp -Vo ${_TMPVUXML} ${VUXML_URL} >/dev/null || exit 1
|
||||||
perl -pi -e 's,\$ARCH,'"${_ARCH}"',g' ${_TMPVUXML}
|
perl -pi -e 's,\$ARCH,'"${_ARCH}"',g' ${_TMPVUXML}
|
||||||
|
|
||||||
_BP_MATCH="$(grep binpatch ${_TMPVUXML} | sed -e 's,<name>,,g;s,</name>,,g;s,\$ARCH,'"${_ARCH}"',g' | sort -u)"
|
_BP_MATCH="$(grep binpatch ${_TMPVUXML} | sed -e 's,<name>,,g;s,</name>,,g;s,\$ARCH,'"${_ARCH}"',g' | sort -u)"
|
||||||
|
for _e in ${EXCLUDE_PKG}; do
|
||||||
if [ -n "${exclude_kernel}" ]; then
|
set -A _BP_MATCH -- ${_BP_MATCH}
|
||||||
_BP_MATCH=$(echo ${_BP_MATCH} | sed -e "s,binpatch${_REL_INT}-${_ARCH}-kernel,,g")
|
_BP_MATCH="$(for _b in ${_BP_MATCH[@]}; do echo ${_b} | grep -v "^${_e}$"; done)"
|
||||||
fi
|
done
|
||||||
|
|
||||||
_PAT=$(pkg_info -q | perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"' | \
|
_PAT=$(pkg_info -q | perl -ne '/^(.*)-(\d[^-]*)[-]?(\w*)(.*)$/ && print "$1\n"' | \
|
||||||
grep -v binpatch${_REL_INT}-${_ARCH} | \
|
grep -v binpatch${_REL_INT}-${_ARCH} | \
|
||||||
|
|
@ -235,8 +246,13 @@ check_vuxml() {
|
||||||
sed 's/^|//' | sed -e 's,++,\\\++,g')
|
sed 's/^|//' | sed -e 's,++,\\\++,g')
|
||||||
_PKG_MATCH=$(grep -Eo '<name>('"${_PAT}"')</name>' ${_TMPVUXML} | \
|
_PKG_MATCH=$(grep -Eo '<name>('"${_PAT}"')</name>' ${_TMPVUXML} | \
|
||||||
sort -u | sed -e 's,<name>,,g;s,</name>,,g')
|
sort -u | sed -e 's,<name>,,g;s,</name>,,g')
|
||||||
|
for _e in ${EXCLUDE_PKG}; do
|
||||||
|
set -A _PKG_MATCH -- ${_PKG_MATCH}
|
||||||
|
_PKG_MATCH="$(for _p in ${_PKG_MATCH[@]}; do echo ${_p} | grep -v "^${_e}$"; done)"
|
||||||
|
done
|
||||||
|
|
||||||
_OUTDATED=$((pkg_add -qnv -Dnosig -Dunsigned ${_BP_MATCH}; pkg_add -qnuv -Dnosig -Dunsigned ${_PKG_MATCH}) 2>/dev/null | \
|
# set to "quirks" if empty to prevent running pkg_add against an empty pkg list
|
||||||
|
_OUTDATED=$((pkg_add -qnv -Dnosig -Dunsigned ${_BP_MATCH:=quirks}; pkg_add -qnuv -Dnosig -Dunsigned ${_PKG_MATCH:=quirks}) 2>/dev/null | \
|
||||||
grep '^Adding.*(pretending)' | \
|
grep '^Adding.*(pretending)' | \
|
||||||
sort -u | \
|
sort -u | \
|
||||||
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
|
sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \
|
||||||
|
|
@ -288,9 +304,15 @@ fi
|
||||||
|
|
||||||
check_openupd
|
check_openupd
|
||||||
|
|
||||||
|
if [ -n "${exclude_kernel}" ]; then
|
||||||
|
EXCLUDE_PKG="binpatch${_REL_INT}-${_ARCH}-kernel ${EXCLUDE_PKG}"
|
||||||
|
fi
|
||||||
|
if [ -n "${EXCLUDE_PKG}" ]; then
|
||||||
|
pr_bigarrow "Excluded package(s)/binpatch(es): ${EXCLUDE_PKG}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${checkmode}" ]; then
|
if [ "${checkmode}" ]; then
|
||||||
check_vuxml
|
check_vuxml
|
||||||
|
|
||||||
else
|
else
|
||||||
if [ -z "${nosig}" ]; then
|
if [ -z "${nosig}" ]; then
|
||||||
if [ "${_REL_INT}" -lt 55 ]; then
|
if [ "${_REL_INT}" -lt 55 ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue