Subject: Re: Improving the "mail info on pkg install/deinstall" semantics ...
To: Jeremy C. Reed <>
From: Johnny C. Lam <>
List: tech-pkg
Date: 07/21/2004 05:19:05
On Tue, Jul 20, 2004 at 07:55:20PM -0700, Jeremy C. Reed wrote:
> The most important thing (I believe) is too have a consistent statement on
> how to use the rc.d scripts and have that automatically appended to the
> Maybe add to the msgadd() or msgprint() function in mk/install/header ?
> I remember that Greg Woods shared some ideas about how the generated
> +DISPLAY MESSAGE should include more too. I didn't see a PR about this
> though.
> See

There is a facility we could add to pkg_add(1) and pkg_delete(1) that
would make implementing your suggestion very easy.  Currently, the
INSTALL/DEINSTALL scripts can only rely on PKG_PREFIX being set in
the environment.  PKG_DBDIR could also passed in the environment,
where PKG_DBDIR points to the package database directory containing
the INSTALL script being executed, e.g., in the overwrite case, samba's
PKG_DBDIR is /var/db/pkg; in the pkgviews case, the PKG_DBDIR is
/usr/pkg/packages for the depoted package, and for the package instance
in a view, PKG_DBDIR is the view's package database directory.  This
would allow the INSTALL/DEINSTALL scripts to locate a package's metadata
files (in ${PKG_DBDIR}/${PKGNAME}), and manipulate them.

I recently wanted this feature because I wanted to be able to create
other files in /var/db/pkg/<pkgname> from within an INSTALL script,
but was thwarted because that information about where the package
database directory was located wasn't known to the INSTALL script.
While it's possible to run "pwd" within the INSTALL script to get that
location, it's not a good idea since it depends on implementation
details of pkg_add(1) and pkg_delete(1).  The better way would be to
have that information explicitly given to the INSTALL script in a
documented way.


	-- Johnny Lam <>