From owner-freebsd-hackers Mon Jun 15 09:22:49 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA08509 for freebsd-hackers-outgoing; Mon, 15 Jun 1998 09:22:49 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from gizmo.dimension.net (gizmo.dimension.net [209.12.7.20]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA08483 for ; Mon, 15 Jun 1998 09:22:25 -0700 (PDT) (envelope-from jaitken@dimension.net) Received: (from jaitken@localhost) by gizmo.dimension.net (8.8.8/8.8.8) id MAA18120; Mon, 15 Jun 1998 12:22:20 -0400 (EDT) From: Jeff Aitken Message-Id: <199806151622.MAA18120@gizmo.dimension.net> Subject: Re: FreeBSD packages (fwd) In-Reply-To: <1122.897926344@time.cdrom.com> from "Jordan K. Hubbard" at "Jun 15, 98 08:59:04 am" To: jkh@time.cdrom.com (Jordan K. Hubbard) Date: Mon, 15 Jun 1998 12:22:19 -0400 (EDT) Cc: jaitken@dimension.net, freebsd-hackers@FreeBSD.ORG Reply-to: jaitken@dimension.net X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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