1
0
Fork 0
forked from mirrors/openup

Fix runtime option parsing.

This commit is contained in:
Antoine Jacoutot 2013-08-08 10:54:59 +02:00
commit 7f59ecbcef

17
openup
View file

@ -40,24 +40,23 @@ if [ "$(id -u)" -ne 0 ]; then
usage usage
fi fi
# magic taken from fw_update(1) # regex taken from fw_update(1)
set -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q') set -A REL -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]*\).*/\1 \2/;q')
release=$1 REL_INT="$(echo ${REL[0]} | tr -d '.')"
tag=$2
release_int="$(echo ${release} | tr -d '.')"
if [ "${tag}" == -!(stable) ]; then if [ "${REL[1]}" == -!(stable) ]; then
error "XXX -current is a no-no" error "XXX -current is a no-no"
exit 1 exit 1
fi fi
if [ "${release_int}" -lt "${OPENUP_MINREL}" ]; then if [ "${REL_INT}" -lt "${OPENUP_MINREL}" ]; then
error "XXX release ${release} is a no-no (non-fatal)" error "XXX release ${REL[0]} is a no-no (non-fatal)"
fi fi
OPENUP_VERSION=1 OPENUP_VERSION=1
OPENUP_MINREL=53 OPENUP_MINREL=53
MEESA=$(readlink -f $0) MEESA=$(readlink -f $0)
REL_INT="$(echo ${REL[0]} | tr -d '.')"
TMPDIR="${TMPDIR:=/tmp}" TMPDIR="${TMPDIR:=/tmp}"
error() { error() {
@ -131,7 +130,7 @@ update_self() {
} }
update_binpatches() { 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 if [ -n "$_BP" ]; then
echo "===> Updating binpatch(es)" echo "===> Updating binpatch(es)"