Re: Installing PEAR packages in an idempotent fashion
Hi Justin, Ansgar,
Justin Pryzby wrote:
The big problem is installing the package itself in, I presume, the
postinst script. My early tests were simply:
pear -q install log
but I found that when the package was installed this process would quit
with an error second time around, stopping the script from being
idempotent. At some stage this problem seemed to evaporate (maybe with
lenny).
Has anybody any words of wisdom to offer on how to handle pear module
installations in an idempotent fashion?
In my new version I've removed a lot of PEAR dependencies, and the only
one that remained was Pear Log, so as Ansgar pointed out, it's a much
better solution to simply but a dependency on php-log and remove pear as
a dependency altogether now that I can! Thanks Ansgar for pointing
that out.
Nevertheless Justin,
t=`tempfile`
trap 'rm -fv -- "$t"' EXIT
pear -q install log 2>"$tempfile" || {
ret=$?
grep -Fx "$the_error_message" >/dev/null "$t" || {
cat "$t"
exit $ret
}
}
rm -f -- "$t"
trap - EXIT
I think this would also have been a great solution, but happily I can
avoid it. I looked at the packaging for php-log itself to see if its
postinst did anything interesting, but (perhaps obviously) it just
installs the raw files that would pear would install and has no need for
postinst magic.
Thanks again to both of you, it's working a treat now on Etch and Lenny.
CT.
Reply to: