net/dictd: @exec in pkg-plist doesn't work?

James Housley jim at Thehousleys.net
Thu Aug 12 03:43:42 PDT 2004


Dryice Liu wrote:
> Hi,
> 
> I'm using net/dictd and I found if I deinstall - install it, or
> portupgrade it, it will overwrite my /usr/local/etc/dictd.conf with a
> default one. I'm trying to fix this but failed (see my patch below)
> 
> Basically I'm install the default one as etc/dictd.conf.sample, and
> use @exec/@unexec to make or copy a etc/dictd.conf. However, only the
> @unexec works as expected. The @exec clause doesn't work, it didn't
> copy a etc/dictd.conf with clean installation. Could anyone help me to
> find out why? I see this is used in many other ports like ftp/lftp and
> net/GeoIp. Thanks!
> 
> BTW, is there any tool to help debug this kind of problem?
> 
> My patch:
> ======================================================================
> diff -ruN dictd/Makefile dictd.new/Makefile
> --- dictd/Makefile	Sat Jun  5 03:18:10 2004
> +++ dictd.new/Makefile	Thu Aug 12 09:02:44 2004
> @@ -47,7 +47,7 @@
>  .for i in example.conf example.dictrc example.site example2.conf example3.conf
>  	${INSTALL_DATA} ${WRKSRC}/$i ${DATADIR}
>  .endfor
> -	@${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/${PORTNAME}.conf > ${PREFIX}/etc/${PORTNAME}.conf
> +	@${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/${PORTNAME}.conf > ${PREFIX}/etc/${PORTNAME}.conf.sample
>  	@${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/${PORTNAME}.sh > ${PREFIX}/etc/rc.d/${PORTNAME}.sh
>  	@${CHMOD} +x ${PREFIX}/etc/rc.d/${PORTNAME}.sh
>  	@${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${PKGMESSAGE}
> diff -ruN dictd/pkg-plist dictd.new/pkg-plist
> --- dictd/pkg-plist	Mon Jan 29 05:23:04 2001
> +++ dictd.new/pkg-plist	Thu Aug 12 16:06:47 2004
> @@ -5,6 +5,8 @@
>  share/dictd/example.site
>  share/dictd/example2.conf
>  share/dictd/example3.conf
> -etc/dictd.conf
> + at unexec if cmp -s %D/etc/dictd.conf %D/etc/dictd.conf.sample; then rm -f %D/etc/dictd.conf; fi
> +etc/dictd.conf.sample
> + at exec if [ ! -f %D/etc/dictd.conf ]; then cp %D/etc/dictd.conf.sample %D/etc/dictd.conf; fi
>  etc/rc.d/dictd.sh
>  @dirrm share/dictd
> ======================================================================
> 
> 

The commands in pkg-plist are only used with packages.  You need similar 
code in the make file for when installing from a port.

Here is what I use in healthd:
-------------------------------------------------
post-install:
         @${REINPLACE_CMD} -e 's|/usr/local/etc/rc.subr|${RC_SUBR}|' 
${WRKSRC}/healthd.sh
         ${INSTALL_SCRIPT} -m 751 ${WRKSRC}/healthd.sh 
${PREFIX}/etc/rc.d/healthd.sh
         @if [ ! -f ${PREFIX}/etc/healthd.conf ]; then \
                 ${ECHO} "Installing ${PREFIX}/etc/healthd.conf 
configuration file."; \
                 ${ECHO} "It is recommended you edit this file to match 
your system"; \
                 ${ECHO} "before running the program."; \
                 ${CP} ${PREFIX}/etc/healthd.conf.sample 
${PREFIX}/etc/healthd.conf; \
         fi
------------------------------------------------

Jim

-- 
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
  X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
jeh at FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim at TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
It's always a long day, 86400 doesn't fit into a short.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3228 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20040812/2844e377/smime.bin


More information about the freebsd-ports mailing list