Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 1999 18:04:56 -0500 (CDT)
From:      Conrad Sabatier <conrads@home.com>
To:        Christian Carstensen <cc@devcon.net>
Cc:        mns@metathink.com, freebsd-hackers@FreeBSD.ORG
Subject:   RE: updating packages automatically, etc.pp.
Message-ID:  <XFMail.990929180456.conrads@home.com>
In-Reply-To: <Pine.BSF.4.10.9909282242380.8593-100000@pauling.research.devcon.net>

next in thread | previous in thread | raw e-mail | index | archive | help

On 28-Sep-99 Christian Carstensen wrote:
> 
> so far, so good,
> 
> first of all, thanks for giving me this much input on my idea. 
> i've had a look at the pkg_version tool, which, with Nik Clayton's
> patch, does more or less what i've been thinking of, when i decided
> to post the initial message to this list.  as Mark Shepard
> discussed in detail, there are a lot of useful features, 
> pkg_version is still lacking. (mark, special thanks to you for 
> taking down these useful notes!)  i'm interested in implementing
> at least some of this functionality using perl, if enough of you
> regard this as a useful tool for system admin.  otherwise, i'll
> put it on the stack of things to do, when nothing else has to
> done ;)  how do you think about it?

Here's a simple little Bourne shell script I threw together the other
day to automatically upgrade installed ports.  I've already used it 
myself, and it works just as expected.  

The script relies on you having an up-to-date INDEX file; do "make
index" first to be sure (which reminds me, why is the INDEX file
always out of sync after a cvsup?).  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.  :-)   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).  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:


#!/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

-- 
Conrad Sabatier
http://members.home.net/conrads/



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?XFMail.990929180456.conrads>