Date: Thu, 21 Aug 2014 11:28:50 -0500 From: Bryan Drewery <bdrewery@FreeBSD.org> To: Matthias Andree <mandree@FreeBSD.org>, ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: Re: svn commit: r365566 - head/Tools/scripts Message-ID: <53F61E42.4050104@FreeBSD.org> In-Reply-To: <201408211556.s7LFuE0p041046@svn.freebsd.org> References: <201408211556.s7LFuE0p041046@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DwcKghKaRUjCNfCpTuCvnRWJeKJrnk6O3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 8/21/2014 10:56 AM, Matthias Andree wrote: > Author: mandree > Date: Thu Aug 21 15:56:14 2014 > New Revision: 365566 > URL: http://svnweb.freebsd.org/changeset/ports/365566 > QAT: https://qat.redports.org/buildarchive/r365566/ >=20 > Log: > Add a BerkeleyDB upgrade helper script in preparation of 4...4.7 remo= val. Thanks for making things simpler. <joke> We now have a script to run another script that was made to make using ports simpler. >=20 > Added: > head/Tools/scripts/BDB-upgrade-helper.sh (contents, props changed) >=20 > Added: head/Tools/scripts/BDB-upgrade-helper.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/Tools/scripts/BDB-upgrade-helper.sh Thu Aug 21 15:56:14 2014 (= r365566) > @@ -0,0 +1,77 @@ > +#!/bin/sh > +# $Id$ > +# ports/Tools/scripts/BDB-upgrade-helper.sh > +# > +# A helper script to upgrade applications that used to depend on > +# BerkeleyDB ports 4.0...4.7 to use a newer version of BerkeleyDB. > +# > +# Written by Matthias Andree in 2014, and placed under the same > +# license as FreeBSD itself, see /COPYRIGHT or /usr/src/COPYRIGHT. > + > +set -eu > +: ${PREFIX:=3D/usr/local} > +: ${LOCALBASE:=3D${PREFIX}} > + > +# check requisites > +tool=3D > +if [ -x ${LOCALBASE}/sbin/portmaster ] ; then tool=3Dportmaster ; > +elif [ -x ${LOCALBASE}/sbin/portupgrade ]; then tool=3Dportupgrade; > +else > + echo >&2 "Neither portmaster nor portupgrade installed. Cannot con= tinue." > + echo >&2 "Please install ports-mgmt/portmaster before proceeding."= > + exit 1 > +fi > + > +# check BerkeleyDB 4.0...4.7 versions > +rx=3D'db4[1-7]?(-nocrypto)?-4' > +if pkg -N 2>/dev/null ; then pkg=3Dyes ; else pkg=3D ; fi > +if [ -n "$pkg" ] ; then > + # pkg > + dbnames=3D$(pkg info -x "$rx") > +else > + # old pkg_* > + dbnames=3D$(pkg_info -E -X "$rx") > +fi > + > +# due to set -e, the script will not reach this point > +# unless there have been matched packages - without packages, > +# pkg_info or pkg will exit with failure. > + > +# check if we need to pass in origins or package names > +if [ "$tool" =3D portupgrade ] ; then > + if [ -n "$pkg" ] ; then > + dbnames=3D$(printf '%s\n' "$dbnames" | xargs -n1 pkg info -q -o) > + else > + dbnames=3D$(printf '%s\n' "$dbnames" | xargs -n1 pkg_info -q -o) > + fi > +fi > + > +# generate the upgrade command > +case "$tool" in > +portmaster) > + cmd=3D"portmaster -R" > + for i in $dbnames ; do cmd=3D"$cmd -r $i" ; done > + ;; > +portupgrade) > + cmd=3D"portupgrade -f -r" > + for i in $dbnames ; do cmd=3D"$cmd -x $i" ; done > + for i in $dbnames ; do cmd=3D"$cmd $i" ; done > + ;; > +*) > + echo >&2 "Internal error in $0." ; exit 1 > + ;; > +esac > + > +echo "+ $cmd" > +$cmd > + > +# due to set -e, the script will not reach this point > +# if there was an error or failure with the upgrade tool > + > +if [ -n "$pkg" ] ; then > + pkg delete $dbnames > +else > + pkg_delete $dbnames > +fi > + > +echo "Success." >=20 --=20 Regards, Bryan Drewery --DwcKghKaRUjCNfCpTuCvnRWJeKJrnk6O3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJT9h5CAAoJEDXXcbtuRpfPrwMH/1e7hW+bvctVF+Uf+H+3FZrx hQoWMbrNlMRcS0yWyWuEx4cWn/OaO7NHOiYhSQdFVacq0lA/fzWsoTHwEurCQ15H HtSWK+rT8SuYJ8hDyGiQ3yUsDfaiYnpN01aoNUbIrjabT270CHGw3aVDO68HjP9n lvXyzSy0dKB/3Joyph+ZLM9RB64mv/xvW91Y60J+L0wfPVWzYmLIQt9LyZqPUmgu hOnhW1+5/cKcAuBgnyhNGQdAfIfq3XrN0ttUp+C4VGtJzVErQ3zpc8UKix8XsOYz /mrGTaB23ROnHtQepAjhxjmsOfRSKO979BESs/+nBAil8ScJJylsECVWIOxrSW4= =BfFf -----END PGP SIGNATURE----- --DwcKghKaRUjCNfCpTuCvnRWJeKJrnk6O3--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53F61E42.4050104>