We need new feature for pkg_create?

Johnny Lam jlam at NetBSD.org
Mon Feb 7 07:43:41 PST 2005


Boris Kovalenko wrote:
> 
>     I'm net/quagga port maintainer. My port is installing some scripts 
> to /etc/rc.d. I know, this is bad, but I really need rcorder to be 
> applied to my scripts.

Could you explain what you mean by needing rcorder to by applied to your 
scripts?  Does that mean that you just want the scripts to be installed 
into /etc/rc.d automatically by the package, regardless of whether you 
do "make install" or pkg_add a binary package?

 > So, to install scripts, I use next trick:
> 
> @cwd %%RC_DIR%%
> quagga%%RC_SUFX%%
> watchquagga%%RC_SUFX%%
> @cwd %%CWD_TRICK%%
> 
> where %%RC_DR%% is set to /etc/rc.d and %%CWD_TRICK%% is set to 
> ${PREFIX}. In most cases this works well, but not in case when pkg_add 
> is used with -p option. So, the question is - may be we really need new 
> feature for pkg_create like @pushwd and @popwd? So, the trick will look 
> like
> 
> @pushwd
> @cwd %%RC_DIR%%
> quagga%%RC_SUFX%%
> watchquagga%%RC_SUFX%%
> @popwd
> 
> So all will be happy and pkg_add -p will work too. Any comments?

You can install the rc.d script somewhere under ${PREFIX} and then write 
a +INSTALL script copy it into place.  The +INSTALL script is invoked 
with PKG_PREFIX set to the correct package prefix, so copying 
${PKG_PREFIX}/share/quagga/quagga${RC_SUFX} to /etc/rc.d/quagga will 
always work correctly.  There would need to be a corresponding action in 
the +DEINSTALL script to remove the rc.d script.

FWIW, the above is what is done in NetBSD pkgsrc.  Pkgsrc has a standard 
set of +INSTALL and +DEINSTALL scripts that are generated during a "make 
install" that are controlled by various Makefile variables.  These 
scripts can create users, copy config files into place, and create 
directories with special permissions, and allow us to extend the pkg_* 
tools in many ways without needing to change the existing semantics or 
behavior of the tools.

	Cheers,

	-- Johnny Lam <jlam at NetBSD.org>


More information about the freebsd-ports mailing list