Date: Tue, 30 Oct 2007 17:53:48 -0200 From: Ricardo Nabinger Sanchez <rnsanchez@wait4.org> To: freebsd-ports@freebsd.org Subject: substitutions in pkg-plist Message-ID: <20071030175348.47c6e060.rnsanchez@wait4.org>
next in thread | raw e-mail | index | archive | help
Hello, While working on an non-public port, I noticed that when I used macros like %%ETCDIR%%, %%EXAMPLESDIR%%, inside @exec, @unexec and @dirrm/@dirrmtry, the terminal output was as expected, but the commands would fail silently. For instance, I tried this (pkg-plist): @exec [ -d %%ETCDIR%%/socksarmor ] || mkdir -v %%ETCDIR%%/socksarmor @unexec if cmp -s %%EXAMPLESDIR%%/socksarmor.config %%ETCDIR%%/socksarmor.config; then rm -f %%ETCDIR%%/socksarmor.config; fi @unexec if cmp -s %%EXAMPLESDIR%%/socksarmor.xml %%ETCDIR%%/socksarmor.xml; then rm -f %%ETCDIR%%/socksarmor.xml; fi When executing pkg_add or pkg_delete (both with -v), the terminal output was fine, but things were not being executed. In this very case, I could confirm with ls that %%ETCDIR%%/socksarmor, for instance, was not being created. I copy-pasted the commands pkg_add printed, verbatim, and they worked as expected. After lots of googling and Mk browsing, I finally decided to partially hardcode things and use %D whenever possible, getting this: @exec [ -d %D/etc/socksarmor ] || mkdir -v %D/etc/socksarmor @unexec if cmp -s %D/share/examples/socksarmor/socksarmor.config %D/etc/socksarmor/socksarmor.config; then rm -f %D/etc/socksarmor/socksarmor.config; fi @unexec if cmp -s %D/share/examples/socksarmor/socksarmor.xml %D/etc/socksarmor/socksarmor.xml; then rm -f %D/etc/socksarmor/socksarmor.xml; fi This works, but it is not clear why %%whatever%% macros fail silently. I couldn't find useful docs, perhaps because google strip %s off my queries. Comments are appreciated. :) Regards. -- Ricardo Nabinger Sanchez rnsanchez@wait4.org Powered by FreeBSD "Left to themselves, things tend to go from bad to worse."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071030175348.47c6e060.rnsanchez>