1
0
Fork 0
forked from mirrors/openup

OPENUP_URL is now valid.

Fix the check for the minimum supported release.
Reverse logic for DRYRUN mode, we don't want to claim to modify anything
when we actually don't.
This commit is contained in:
Antoine Jacoutot 2013-08-06 10:03:36 +02:00
commit 782f8fb411

14
openup
View file

@ -22,15 +22,14 @@
# extend usage() with doc from web # extend usage() with doc from web
### user defined variables ### user defined variables
#OPENUP_URL='https://stable.mtier.org/openup' OPENUP_URL='https://stable.mtier.org/openup'
OPENUP_URL='https://www.bsdfrog.org/tmp/openup'
PKG_CERT_URL='https://stable.mtier.org/mtier.cert' PKG_CERT_URL='https://stable.mtier.org/mtier.cert'
PKG_CERT_REGEX='M:Tier Ltd. OpenBSD Stable Updates' PKG_CERT_REGEX='M:Tier Ltd. OpenBSD Stable Updates'
### end of user defined variables ### end of user defined variables
# do not change this!!! # do not change this!!!
OPENUP_VERSION=0 OPENUP_VERSION=0
OPENUP_MINREL=5.3 OPENUP_MINREL=53
error() { error() {
echo -n "*** ERROR: $@" echo -n "*** ERROR: $@"
@ -47,7 +46,7 @@ check_unsup() {
exit 1 exit 1
fi fi
if [ "${version}" -lt ${OPENUP_MINREL} ]; then if [ "$(echo ${version} | tr -d '.')" -lt "${OPENUP_MINREL}" ]; then
error "XXX release ${version} is a no-no (non-fatal)" error "XXX release ${version} is a no-no (non-fatal)"
fi fi
} }
@ -70,7 +69,7 @@ get_cert() {
fi fi
echo "===> Installing certificate" echo "===> Installing certificate"
[[ -n ${DRYRUN} ]] || cat /tmp/mtier.cert >>/etc/ssl/pkgca.pem [[ -z ${DRYRUN} ]] && cat ${_CERT} >>/etc/ssl/pkgca.pem
[ $? -eq 0 ] && echo "successfully added certificate to /etc/ssl/pkgca.pem" [ $? -eq 0 ] && echo "successfully added certificate to /etc/ssl/pkgca.pem"
rm -f ${_CERT} rm -f ${_CERT}
} }
@ -82,14 +81,15 @@ update_self() {
_F=$(mktemp -p ${TMPDIR:=/tmp} pkg_cert.XXXXXXXXXX) || exit 1 _F=$(mktemp -p ${TMPDIR:=/tmp} pkg_cert.XXXXXXXXXX) || exit 1
ftp -Vo ${_F} ${OPENUP_URL} ftp -Vo ${_F} ${OPENUP_URL}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
error "XXX could not check for upenup update; it's a no-no (non-fatal)" error "XXX could not check for openup update; it's a no-no (non-fatal)"
return 1
fi fi
_N=$(grep -Eo '^OPENUP_VERSION=.*' ${_F} | awk -F '=' '{ print $2 }') _N=$(grep -Eo '^OPENUP_VERSION=.*' ${_F} | awk -F '=' '{ print $2 }')
[[ -n "${_N}" ]] && \ [[ -n "${_N}" ]] && \
if [ "${OPENUP_VERSION}" -lt "${_N}" ]; then if [ "${OPENUP_VERSION}" -lt "${_N}" ]; then
echo "===> Updating openup(8) from version ${OPENUP_VERSION} to version ${_N}" echo "===> Updating openup(8) from version ${OPENUP_VERSION} to version ${_N}"
[[ -n "${DRYRUN}" ]] || cat ${_F} >${MEESA} [[ -z "${DRYRUN}" ]] && cat ${_F} >${MEESA}
[ $? -eq 0 ] && \ [ $? -eq 0 ] && \
rm -f ${_F} rm -f ${_F}
echo "successfully updated openup(8) to version ${_N}, restarting myself" && \ echo "successfully updated openup(8) to version ${_N}, restarting myself" && \