From owner-freebsd-hackers Thu Sep 30 0:15: 9 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from rucus.ru.ac.za (rucus.ru.ac.za [146.231.29.2]) by hub.freebsd.org (Postfix) with SMTP id 82267159EF for ; Thu, 30 Sep 1999 00:14:59 -0700 (PDT) (envelope-from nbm@rucus.ru.ac.za) Received: (qmail 86951 invoked by uid 1003); 30 Sep 1999 07:17:06 -0000 Date: Thu, 30 Sep 1999 09:17:06 +0200 From: Neil Blakey-Milner To: Conrad Sabatier Cc: Christian Carstensen , mns@metathink.com, freebsd-hackers@FreeBSD.ORG Subject: Re: updating packages automatically, etc.pp. Message-ID: <19990930091706.A85599@rucus.ru.ac.za> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i In-Reply-To: Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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