From e30c78e50e1556a8fd7f8999bf5cd1e9c8d953eb Mon Sep 17 00:00:00 2001 From: Antoine Jacoutot Date: Wed, 4 Sep 2013 14:53:56 +0200 Subject: [PATCH] Fix run in non dry-run mode. Add squeleton for the -K option. --- openup | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/openup b/openup index f843a77..4495198 100755 --- a/openup +++ b/openup @@ -29,18 +29,19 @@ VUXML_URL="https://stable.mtier.org/vuxml/$(uname -r | tr -d '.').xml" ### DO NOT MODIFY ANYTHING BELOW THIS LINE!!! ### ######################################################################## -_OPENUP_VERSION=6 +_OPENUP_VERSION=7 _OPENUP_MINREL=53 usage() { echo - echo "Usage: ${0##*/} [-SUn]|[-c]" >&2 + echo "Usage: ${0##*/} [-K][-Sn|c]" >&2 echo echo "Options:" + echo " -K do not check for kernel binpatches (when running non GENERIC)" echo " -S do not check for package signatures" echo " -n dry-run mode, no modification is done" echo - echo " -c check/cron mode, mutually exclusive with other options" + echo " -c check/cron mode (cannot be used with -S and/or -n)" exit 1 } @@ -133,7 +134,7 @@ check_openupd() { fi if [ -n "${_N}" -o -n "${dryrun}" ]; then - if [ "${_OPENUP_VERSION}" -lt "${_N}" -o -z "${dryrun}" ]; then + if [ "${_OPENUP_VERSION}" -lt "${_N}" ]; then pr_error "New openup release (version ${_N}) is available; please update with:" pr_error "ftp -Vo $(readlink -f $0) ${OPENUP_URL}" pr_error "Exiting" @@ -172,13 +173,13 @@ check_vuxml() { perl -pi -e 's,\$ARCH,'"$(arch -s)"',g' ${_TMPVUXML} _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 | \ + _BP_OUTDATED=$(pkg_add -qnv -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"') - _PKG_OUTDATED=$(pkg_add -nuv -D nosig 2>/dev/null | \ + _PKG_OUTDATED=$(pkg_add -qnuv -D nosig 2>/dev/null | \ grep '(installing)(pretending)' | \ grep -v binpatch${_REL_INT}-$(arch -s) | \ sed -e 's,Adding ,,;s,(pretending),,;s,->.*,,' | \ @@ -197,8 +198,9 @@ check_vuxml() { done | fmt | sed '/^$/d' } -while getopts 'SUcn' arg; do +while getopts 'KScn' arg; do case ${arg} in + K) exclude_kernel=1 ;; S) nosig=1; pkg_opt="${pkg_opt} -D nosig" ;; c) checkmode=1 ;; n) dryrun=" (dry run)"; pkg_opt="${pkg_opt} -n -D nosig" ;;