Re: Determining if package installed
>>>>> "LaMont" == LaMont Jones <lamont@hp.com> writes:
LaMont> I have a package (Postfix) that wants to behave
LaMont> differently if NIS is installed (more to the point, if
LaMont> there is an NIS alias map). Since I've managed to remain
LaMont> almost completely clueless on NIS, I was hoping someone
LaMont> could tell me the best way to see if NIS is installed, or
LaMont> scheduled to be installed.
If you have `autofs' installed, you will see a good example in
`/etc/init.d/autofs'. Basically, to see if there are any NIS
autofs maps, the check is:
if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master 2>/dev/null | wc -l` -gt 0 ]
then
...
fi
You could do something similar, except use 'mail.aliases' instead of
'auto.master'. And frankly, instead of using 'wc -l' and '-gt', I
would do:
if [ -e /usr/bin/ypcat ] && [ -n "`ypcat -k mail.aliases 2>/dev/null" ]
LaMont> Then, of course, there is the question of the best way to
LaMont> tell the user (who probably has no intention of installing
LaMont> NIS) that if he ever does, he'll need to edit the Postfix
LaMont> config file if he wants a NIS alias map to be used...
Do you have an /etc/init.d startup/shutdown script in that package?
If so, one way could be to do a sanity check there, then e.g. mail
root@localhost if the check fails.
Just an idea.
-tor
Reply to: