Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Feb 2005 13:23:35 -0500
From:      "Johnny C. Lam" <jlam@NetBSD.org>
To:        Boris Kovalenko <boris@ntmk.ru>
Subject:   Re: We need new feature for pkg_create?
Message-ID:  <4207B227.3070600@NetBSD.org>
Resent-Message-ID: <20050207190545.GA86501@phoenix.buildlink.org>
In-Reply-To: <42079BB9.1020101@ntmk.ru>
References:  <42075175.20603@ntmk.ru> <42078CC1.6080709@NetBSD.org> <42079BB9.1020101@ntmk.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
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@NetBSD.org>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4207B227.3070600>