Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jun 1998 12:22:19 -0400 (EDT)
From:      Jeff Aitken <jaitken@dimension.net>
To:        jkh@time.cdrom.com (Jordan K. Hubbard)
Cc:        jaitken@dimension.net, freebsd-hackers@FreeBSD.ORG
Subject:   Re: FreeBSD packages (fwd)
Message-ID:  <199806151622.MAA18120@gizmo.dimension.net>
In-Reply-To: <1122.897926344@time.cdrom.com> from "Jordan K. Hubbard" at "Jun 15, 98 08:59:04 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Jordan K. Hubbard writes:
> > However, I can't seem to find out what the name of the saved command
> > is _from within my package_.  I can see that if I replace
> > /usr/bin/foo, the original /usr/bin/foo is renamed to
> > /usr/bin/.foo.PACKAGENAME.backup.
> 
> Well, that heuristic is unlikely to change and no, I don't have any
> particular way of finding out the filename - how would you prefer to
> have access to that info if I modified the pkg tools to make it
> available?  It would hardly be difficult to add, but I'm not sure just
> how you'd want the semantics of this to look.


I think the best approach would be to define environment variables
with various bits of useful information, which can be accessed from
installation/removal scripts.  The reason I like this approach is
that it is extensible: supplying installation scripts with more
information at a later date (i.e., stuff you or I might not think of
now but someone else does later ) is as easy as defining a few new
environment variables in pkg_create/pkg_add.

This is also how several other OSes do it:


Solaris 2.x:

Any files to be overwritten can be copied into a directory that you
can access from {pre,post}install scripts.  The packaging tools set
the envionment variable ${PKGSAV} to this directory name.  So, for
example, /usr/bin/foo can be moved to ${PKGSAV} in a preinstall
script, and moved back to /usr/bin in the postremove script.  (At
least, I don't think this happens automagically).


Digital UNIX 4.0:

Files to be overwritten are automatically saved in their existing
directories with a different suffix.  This suffix can be accessed
from {pre,post}install scripts as the environment variable
${_ORGEXT}.  So, for example, /usr/bin/foo becomes 
/usr/bin/foo.${_ORGEXT}.  As I recall, setld does all of this for
you (whereas some other places you have to do the moving yourself).


HP-UX 10.x gives similar functionality, but I haven't quite figured
it out yet.  HP and IBM have made their software packaging procedure
w-a-y too complicated, so I've made less progess there. :-)



--Jeff


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?199806151622.MAA18120>