forked from mirrors/openup
Only output what will be done in dry-run mode.
Factorize evaluation of commands. Bump VERSION, we want people to test.
This commit is contained in:
parent
afd187f805
commit
dccdf883f8
1 changed files with 15 additions and 13 deletions
28
openup
28
openup
|
|
@ -29,7 +29,7 @@ VUXML_URL="https://stable.mtier.org/vuxml/$(uname -r | tr -d '.').xml"
|
|||
### DO NOT MODIFY ANYTHING BELOW THIS LINE!!! ###
|
||||
########################################################################
|
||||
|
||||
_OPENUP_VERSION=9
|
||||
_OPENUP_VERSION=10
|
||||
_OPENUP_MINREL=53
|
||||
|
||||
usage() {
|
||||
|
|
@ -40,7 +40,7 @@ usage() {
|
|||
echo " -K do not check for kernel binpatches (when running non GENERIC)"
|
||||
echo " -S do not check for package signatures"
|
||||
echo " -c check/cron mode, report only (cannot be used with -S and/or -n)"
|
||||
echo " -n dry-run mode, no modification is done"
|
||||
echo " -n dry-run mode, only report what would be done"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
|
@ -92,11 +92,17 @@ pr_bigarrow() {
|
|||
}
|
||||
|
||||
pr_smallarrow() {
|
||||
if [ -z "${checkmode}" ]; then
|
||||
if [ -z "${checkmode}" -a -n "${dryrun}" ]; then
|
||||
echo "-> ${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
cmd.exe() {
|
||||
if [ -z "${dryrun}" ]; then
|
||||
eval "${@}" || exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
get_cert() {
|
||||
local _CMD
|
||||
|
||||
|
|
@ -113,15 +119,13 @@ get_cert() {
|
|||
_CMD="ftp -Vo ${_TMPCERT} ${PKG_CERT_URL}"
|
||||
pr_smallarrow "${_CMD}"
|
||||
if [ -z "${dryrun}" ]; then
|
||||
eval ${_CMD} || exit 1
|
||||
cmd.exe ${_CMD}
|
||||
fi
|
||||
|
||||
pr_bigarrow "Installing certificate"
|
||||
_CMD="cat ${_TMPCERT} >>/etc/ssl/pkgca.pem"
|
||||
pr_smallarrow "${_CMD}"
|
||||
if [ -z "${dryrun}" ]; then
|
||||
eval ${_CMD} || exit 1
|
||||
fi
|
||||
cmd.exe ${_CMD}
|
||||
}
|
||||
|
||||
check_openupd() {
|
||||
|
|
@ -130,9 +134,7 @@ check_openupd() {
|
|||
pr_bigarrow "Checking for openup update"
|
||||
_CMD="ftp -Vo - ${OPENUP_URL} | awk -F '=' '/^_OPENUP_VERSION/ { print \$2 }'"
|
||||
pr_smallarrow "${_CMD}"
|
||||
if [ -z "${dryrun}" ]; then
|
||||
_N=$(eval ${_CMD}) || exit 1
|
||||
fi
|
||||
_N=$(cmd.exe ${_CMD})
|
||||
|
||||
if [ "${_OPENUP_VERSION}" -lt "${_N}" ]; then
|
||||
pr_error "New openup release (version ${_N}) is available; please update with:"
|
||||
|
|
@ -154,7 +156,7 @@ update_binpatches() {
|
|||
pr_bigarrow "Installing/updating binpatch(es)"
|
||||
_CMD="pkg_add ${pkg_opt} ${_BP}"
|
||||
pr_smallarrow "${_CMD}"
|
||||
eval ${_CMD}
|
||||
cmd.exe ${_CMD}
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -169,10 +171,10 @@ update_pkg() {
|
|||
pr_smallarrow "${_CMD}"
|
||||
# we don't want to display ${_PKG}, there could be hundreds
|
||||
_CMD="${_CMD} ${_PKG}"
|
||||
eval ${_CMD}
|
||||
cmd.exe ${_CMD}
|
||||
}
|
||||
|
||||
# this only outputs the most recent vulnerability for each pkg
|
||||
# this only outputs the most recent vulnerability for each matching pkg
|
||||
check_vuxml() {
|
||||
local _BP_MATCH _OUTDATED _PAT _PKG_MATCH
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue