From 7f59ecbcef7ee02904c783c864f613d96ec12417 Mon Sep 17 00:00:00 2001 From: Antoine Jacoutot Date: Thu, 8 Aug 2013 10:54:59 +0200 Subject: [PATCH] Fix runtime option parsing. --- openup | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/openup b/openup index a0e2a26..07435a5 100755 --- a/openup +++ b/openup @@ -40,24 +40,23 @@ if [ "$(id -u)" -ne 0 ]; then usage fi -# magic taken from fw_update(1) -set -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q') -release=$1 -tag=$2 -release_int="$(echo ${release} | tr -d '.')" +# regex taken from fw_update(1) +set -A REL -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q') +REL_INT="$(echo ${REL[0]} | tr -d '.')" -if [ "${tag}" == -!(stable) ]; then +if [ "${REL[1]}" == -!(stable) ]; then error "XXX -current is a no-no" exit 1 fi -if [ "${release_int}" -lt "${OPENUP_MINREL}" ]; then - error "XXX release ${release} is a no-no (non-fatal)" +if [ "${REL_INT}" -lt "${OPENUP_MINREL}" ]; then + error "XXX release ${REL[0]} is a no-no (non-fatal)" fi OPENUP_VERSION=1 OPENUP_MINREL=53 MEESA=$(readlink -f $0) +REL_INT="$(echo ${REL[0]} | tr -d '.')" TMPDIR="${TMPDIR:=/tmp}" error() { @@ -131,7 +130,7 @@ update_self() { } update_binpatches() { - local _BP=$(pkg_info -Q binpatch${release_int}-$(arch -s) | sed 's/.[^-]*$//' | sort -u) + local _BP=$(pkg_info -Q binpatch${REL_INT}-$(arch -s) | sed 's/.[^-]*$//' | sort -u) if [ -n "$_BP" ]; then echo "===> Updating binpatch(es)"