Date: Thu, 30 Sep 1999 09:17:06 +0200 From: Neil Blakey-Milner <nbm@mithrandr.moria.org> To: Conrad Sabatier <conrads@home.com> Cc: Christian Carstensen <cc@devcon.net>, mns@metathink.com, freebsd-hackers@FreeBSD.ORG Subject: Re: updating packages automatically, etc.pp. Message-ID: <19990930091706.A85599@rucus.ru.ac.za> In-Reply-To: <XFMail.990929180456.conrads@home.com> References: <Pine.BSF.4.10.9909282242380.8593-100000@pauling.research.devcon.net> <XFMail.990929180456.conrads@home.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed 1999-09-29 (18:04), Conrad Sabatier wrote: > It only tries to upgrade ports which have a single version installed, > basically because I haven't gotten around yet to handling the parsing > of pkg_version's output where more than one version of a port is > installed. :-) Patch at http://rucus.ru.ac.za/~nbm/pkg_version-patch > The script checks to make sure that the new version builds > successfully and is ready to be installed before deleting the old > version (the reason for all those "&&" thingies). There may be a problem if pkg_delete returns an error code if it is missing files, or something. You also lose if make install fails, which isn't very often, admittedly. One solution I've got working is running pkg_create using the information in /var/db/pkg/foo-1.0/ much like the fake-pkg target in ports. Then you can "make install clean || pkg_add foo-1.0" to make sure you at least get a working copy in the end. (This ties in with plans to make changing and upgrading ports back-out-able, which was mentioned as something nice we should aim for.) > It should probably also check to see > whether a port is interactive or not, but that's another thing I have > yet to do. :-) Ignore the line wrap, by the way: "make BATCH=1", instead of just "make". > #!/bin/sh > > for old_pkg in `pkg_version -v | grep '<' | awk '{print $1}'` > do > new_pkg=`echo $old_pkg | sed 's/-[0-9].*$//'` > > echo Upgrading $old_pkg > > cd /usr/ports/*/${new_pkg} && make && pkg_delete -f $old_pkg > && make install clean > done You also lose any "dependency" information, which isn't too great. You can find the directory of alternate version ports in /usr/ports/INDEX (much like pkg_version) - grep for the exact version specified in the return from pkg_version, and you pick up the correct ports directory as a bonus. Neil -- Neil Blakey-Milner nbm@rucus.ru.ac.za To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990930091706.A85599>