We need new feature for pkg_create?

Johnny C. Lam jlam at NetBSD.org
Mon Feb 7 11:05:46 PST 2005


Boris Kovalenko wrote:
> Johnny Lam wrote:
> 
>> Boris Kovalenko wrote:
> 
>> 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.
> 
> 
> Hmm... still misunderstand You.. May You give a quick example?

You can create a .../quagga/INSTALL file that looks like (there's more 
to making a nice INSTALL script but the idea is there):

#!/bin/sh
case $2 in
POST-INSTALL)
	[ -f /etc/rc.d/quagga ] ||
	cp ${PKG_PREFIX}/share/quagga/quagga.sh /etc/rc.d/quagga
	;;
esac

and then also a DEINSTALL script that looks like:

#!/bin/sh
case $w in
DEINSTALL)
	[ -f /etc/rc.d/quagga ] && rm -f /etc/rc.d/quagga
	;;
esac

When this package is added with pkg_add, then the INSTALL script will be 
invoked as per the pkg_add man page, and will copy the rc.d script into 
place at post-install time.  The DEINSTALL script will remove it during 
deinstallation.

I hope this helps!

	Cheers,

	-- Johnny Lam <jlam at NetBSD.org>



More information about the freebsd-ports mailing list