1
0
Fork 0
forked from mirrors/openup

Extend usage and doc.

This commit is contained in:
Antoine Jacoutot 2013-08-14 10:36:28 +02:00
commit 94ed4cae6c

16
openup
View file

@ -18,7 +18,6 @@
# TODO
# https://stable.mtier.org/vuxml/53.xml
# extend usage() with doc from web; complete openup doc in usage()
### user defined variables
OPENUP_URL='https://stable.mtier.org/openup'
@ -29,13 +28,16 @@ PKG_CERT_FPRINT='DE:29:0F:7F:B8:0E:36:5A:AF:A9:BF:E0:4E:08:C2:0F:2D:50:16:97'
### DO NOT MODIFY ANYTHING BELOW THIS LINE!!!
usage() {
echo
echo "usage: ${0##*/} [-SUn]" >&2
echo " -S do not check for package signatures"
echo " -U do not check for openup update"
echo " -n dry run mode, no modification is done"
exit 1
}
error() {
echo "!!! ${@}"
exit 1
}
if [ "$(id -u)" -ne 0 ]; then
@ -49,11 +51,18 @@ REL_INT="$(echo ${REL[0]} | tr -d '.')"
if [ "${REL[1]}" == -!(stable) -o "${REL_INT}" -lt "${OPENUP_MINREL}" ]; then
error "${REL[0]}${REL[1]} is not a supported release"
exit 1
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)"
error "No package repository defined in pkg.conf(5) nor PKG_PATH"
error
error "The \${PKG_PATH} environment variable can be set as follow:"
error "PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/\$(uname -r)/packages/\$(arch -s)"
error "PKG_PATH=https://stable.mtier.org/updates/\$(uname -r)/\$(arch -s):\${PKG_PATH}"
error "export PKG_PATH"
exit 1
fi
fi
@ -64,6 +73,7 @@ if [ -n "${_BPLIST}" ]; then
_v=$(echo ${_BPLIST} | grep "^binpatch${REL_INT}" | wc -w)
if [ "${_i}" -ne "${_v}" ]; then
error "Binpatch(es) from a previous release installed"
exit 1
fi
fi
unset _BPLIST