diff --git a/openup b/openup index 2a44175..9541251 100755 --- a/openup +++ b/openup @@ -18,7 +18,6 @@ # TODO # https://stable.mtier.org/vuxml/53.xml -# check for pkg.conf installpath and/or PKG_PATH # check for installed binpatches from a previous release # extend usage() with doc from web; complete openup doc in usage() @@ -36,6 +35,11 @@ usage() { exit 1 } +error() { + echo "!!! ${@}" + exit 1 +} + if [ "$(id -u)" -ne 0 ]; then echo "need root privileges to run this script" usage @@ -46,8 +50,13 @@ set -A REL -- $(sysctl -n kern.version | sed 's/^OpenBSD \([0-9]\.[0-9]\)\([^ ]* REL_INT="$(echo ${REL[0]} | tr -d '.')" if [ "${REL[1]}" == -!(stable) -o "${REL_INT}" -lt "${OPENUP_MINREL}" ]; then - echo "!!! ${REL[0]}${REL[1]} is not a supported release" - exit 1 + error "${REL[0]}${REL[1]} is not a supported release" +fi + +if ! grep -q installpath /etc/pkg.conf 2>/dev/null; then + if [ -z "${PKG_PATH}" ]; then + error "No package repository available (pkg.conf(5) and/or PKG_PATH)" + fi fi OPENUP_VERSION=2