On Sat, Jun 22, 2002 at 07:18:28PM -0500, Steve Langasek wrote: > On Sat, Jun 22, 2002 at 07:08:00PM +0200, Andreas Metzler wrote: >> Is there some canonical fast way to check in a script whether inn, >> inn2 or cnews is installed on the system?
>> I need to know it in newsx's wrapper skript to set the correct >> options. Until now I've used >> if [ -e /usr/share/doc/inn/copyright ] ... >> which works well, but breaks policy 13.3. I would have liked to check >> for existence of /var/lib/dpkg/info/$package.list, but this'll still >> be there if the package is deinstalled but not purged. >> I'd rather not check for some files in the package like >> /usr/lib/news/input/newsrun vs. /usr/sbin/ctlinnd because they tend >> to be moved around, and calling dpkg'd be slow. > What do you do differently depending on which of these packages are > installed? The best way to handle it is by directly testing for > *exactly* those parts of the package that you use -- that is, if you > invoke a different program for each of the packages, look for the exact > binary. Hello, Good advise, but not that simple in the special case, which is probably the reason I did not think of it myself. I do some things: * use either /etc/news/newsfeeds or /etc/news/sys (darn, a conffile) * use option --inn or --cnews (changes how newsx works internally, ie. what and where to lock, where to move failed postings, etc.) * where to place lockfiles /var/run/news, /var/run/innd, etc. * where to look for outgoing/incoming directory. * where to look for the spool /var/spool/news/{,articles} (obsolete, only needed for inn2 <= 2.2) > Checking for anything in /usr/share/doc is not kosher; policy requires > that you not depend on anything in that directory for a package to > function correctly. I know, see above, that's why I asked. > Checking for actual features that are going to be > used is always the safest solution -- and often the most efficient. newsfeeds lock outgoing cnews: /etc/news/sys /usr/lib/news /vspn/out.going/spoolname/togo inn /etc/news/newsfeeds /var/run/innd /vspn/.outgoing (not shipped in deb) inn2 /etc/news/newsfeeds /var/run/news /vspn/outgoing (.outgoing exists, too) Because iirc inn1 once shipped symlinks for out.going, I am not going to use it and'll probably use /var/run/innd --> inn /var/spool/news/articles --> inn2 /usr/lib/news/config --> cnews. Thanks to you and all the other suggestions! I like your solution best because it is the most straightforward one and does not require calling dpkg or reading the 1 MB sized status-file. thanks, cu andreas -- Hey, da ist ein Ballonautomat auf der Toilette! vim:ls=2:stl=***\ Sing\ a\ song.\ *** -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]