Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Aug 2004 06:43:29 -0400
From:      James Housley <jim@Thehousleys.net>
To:        Dryice Liu <dryice@hotpop.com>
Cc:        dd@freebsd.org
Subject:   Re: net/dictd: @exec in pkg-plist doesn't work?
Message-ID:  <411B49D1.30807@Thehousleys.net>
In-Reply-To: <86657og3je.fsf@dryice.3322.org>
References:  <86657og3je.fsf@dryice.3322.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format.

--------------ms010205040306030809060902
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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
> +@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
> +@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@FreeBSD.org      http://www.FreeBSD.org     The Power to Serve
jim@TheHousleys.Net  http://www.TheHousleys.net
---------------------------------------------------------------------
It's always a long day, 86400 doesn't fit into a short.

--------------ms010205040306030809060902
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJIzCC
AuwwggJVoAMCAQICAwucmTANBgkqhkiG9w0BAQQFADBiMQswCQYDVQQGEwJaQTElMCMGA1UE
ChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkgTHRkLjEsMCoGA1UEAxMjVGhhd3RlIFBlcnNv
bmFsIEZyZWVtYWlsIElzc3VpbmcgQ0EwHhcNMDQwMTMxMTkxMTAwWhcNMDUwMTMwMTkxMTAw
WjBeMRAwDgYDVQQEEwdIb3VzbGV5MQ4wDAYDVQQqEwVKYW1lczEWMBQGA1UEAxMNSmFtZXMg
SG91c2xleTEiMCAGCSqGSIb3DQEJARYTamltQHRoZWhvdXNsZXlzLm5ldDCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAM70siVrpNeIN29fGXTeZx4DuD8BQDzS4F9QLhypRRv2
aL+B1DvaX3spU9O7TktIKeXwJ4pN7iiL6RFXX53QdyXht96ILFVuSsYxM3vaAI+M446KmMKL
1PT033SFCQVb8/DsbJPGQqMauWfon9hdjx8B+PqZyMDRoprj2mJrlUtaGwUGDMYzsE+qG+dY
v20Z9JH1nXVxMpsktz1kON2oFWmemobcoGO2swhb5CmG7KYiKKZW/ItsDwhu5ZebeB63UkUl
SL/+GiUPiieGxnptEDYf5RH/wdN/29I7IeZuab8YajAk2WO+68vAYA3+d/nTgX9YCeGdkPS6
9KxDELa7c8MCAwEAAaMwMC4wHgYDVR0RBBcwFYETamltQHRoZWhvdXNsZXlzLm5ldDAMBgNV
HRMBAf8EAjAAMA0GCSqGSIb3DQEBBAUAA4GBALGpfU4DorG1pNJyzuGAeJY0QWUrZMDmryk/
r08DfcBpE/BicfJXEuee41NWh+7Y2Y4fVdaAo5UAtjDjj8novAR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aFuenHNcsMJyvIhGE4J472GIedbEvinADRvlNs828gHA20r4
iVzVEqW/syqnb1k8rXkaHtODYjK/zU5Xc3MTLWICYlJfQBvdv8J5+j/DOx/NgR1sjFlDWbr6
Cub96g3olcsZhAfz7SVkG80tGzXeNjT+HZFkUruQbuWcVq/SAAAAAAAA
--------------ms010205040306030809060902--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?411B49D1.30807>