Subject: Re: atomic pkgsrc
To: James K. Lowden <>
From: Jeremy C. Reed <>
List: tech-pkg
Date: 05/12/2004 23:36:55
On Wed, 12 May 2004, James K. Lowden wrote:

> Suppose on a freshly installed box I set:
> 	LOCALBASE=/usr/pkg-2003Q4
> 	PKG_DBDIR=/var/db/pkg-2003Q4
> and add two symlinks:
> 	ln -s $LOCALBASE /usr/pkg
> 	ln -s $PKG_DBDIR /var/db/pkg
> It seems to me I can "make install" merrily with nary a soul minding.
> Suppose later I decide it's time to upgrade.  Rather than updating in
> place, I adjust:
> 	LOCALBASE=/usr/pkg-2004Q1
> 	PKG_DBDIR=/var/db/pkg-2004Q1

Yes, that will work. I have installed pkgsrc multiple times on same box
such as to /usr/pkgsrc as well as in my own home directory. (Also on same
box as FreeBSD ports in use too.)

> The only thing I can see is that /etc (and maybe /var) might get modified.
>  But that's very rare, and I bet there's some magical attribute I could
> use to prevent writing to those places, handling them specially.

/etc is easy. By default, it will use your /usr/pkg-2003Q4/etc and then
/usr/pkg-2004Q1/etc directories. (And then you'd have to manually adjust
or copy over your configs as needed.)

As for /var ... that is not clean, yet. There has been discussion on and
off for more than a few years about a variable for /var style data.
Hopefully, this week VARBASE will become real and over next year it will
be implemented by most significant packages.

Your idea is fine, but one problem is wasting time and resources
rebuilding software that just does not need to be rebuilt.

So probably a better idea is to start using pkgviews. It is not complete,
but works well for many packages. (I started using pkgsrc pkgviews under
FreeBSD last month.)

An even quicker and easier method is to use binary packages provided by
the project or others. (I even have a custom pkg_add that has an
upgrade-in-place option which I use to overwrite packages.)

But if you have a production system, pkgviews would probably be better
because you could (in most cases) switch back-n-forth to old and new

 Jeremy C. Reed

 	  	 	 open source, Unix, *BSD, Linux training