From 96259b429cd135d744ce17f81c8e6eef0981f556 Mon Sep 17 00:00:00 2001 From: Antoine Jacoutot Date: Mon, 30 Dec 2013 14:35:36 +0100 Subject: [PATCH] Renove old binpatches entries; not bumping yet, I prefer to have it in a wild for a bit. --- openup | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/openup b/openup index 97e11be..a8def99 100755 --- a/openup +++ b/openup @@ -83,18 +83,6 @@ if [ -n "${_badrel}" ]; then exit 1 fi -# check that we have no installed binpatches from a previous release -_BPLIST=$(pkg_info -q | grep "^binpatch") -if [ -n "${_BPLIST}" ]; then - _i=$(echo ${_BPLIST} | wc -w) - _v=$(echo ${_BPLIST} | grep "^binpatch${_REL_INT}" | wc -w) - if [ "${_i}" -ne "${_v}" ]; then - pr_error "Binpatch(es) from a previous release installed" - exit 1 - fi -fi -unset _BPLIST - _ARCH=$(arch -s) _TMPDIR="${TMPDIR:=/tmp}" _TMPCERT=$(mktemp -p ${_TMPDIR} .openup-pkg_cert.XXXXXXXXXX) || exit 1 @@ -162,6 +150,23 @@ check_openupd() { fi } +# check that we have no installed binpatches from a previous release and +# if so remove the entries manually (we don't want pkg_delete to +# nodify nor error out on installed files from newer release/binpatch) +rm_old_bp() { + local _bp + local _BPDB=$(ls -d /var/db/binpatch/[0-9]* |grep -v ${_REL}) + local _BPPKG=$(ls -d /var/db/pkg/binpatch* |grep -v binpatch${_REL_INT}) + if [ -n "${_BPPKG}" -o -n "${_BPDB}" ]; then + pr_bigarrow "Removing old binpatch(es) entry" + fi + for _bp in ${_BPPKG} ${_BPDB}; do + _CMD="rm -rf ${_bp}" + pr_smallarrow "${_CMD}" + cmd.exe ${_CMD} + done +} + update_binpatches() { local _BP _CMD @@ -269,6 +274,7 @@ if [ "${checkmode}" ]; then else if [ -z "${nosig}" ]; then get_cert; fi + rm_old_bp update_binpatches update_pkg fi