procmail
[Top] [All Lists]

Re: [Q] using conditionals in rc file

1999-12-29 00:49:16
Sam asked,

| I want to set the PATH envar based on platform procmail runs on.

| if ( architecture = sunos4-sun4 )
| then
|    PATH=/sun4/binaries
| elsif ( architecture = netbsd-i386 )
|    PATH=/netbsd/binaries
| elsif ( architecture = linux-i386 )
|    PATH=/linux/binaries
| else

How would you determine $architecture?  For example, can you be sure that
the default PATH when procmail starts will include a uname binary, so that
you can reliably run uname -a?  Or is there some path to uname that will
work on all machines?

If so,

 architecture=`uname -a` # full path if necessary

 :0
 * architecture ?? sunos4-sun4
 { toplevel=sun4 }
 :0E
 * architecture ?? ()\/(netbsd|linux)-i386
 * MATCH ?? ^^\/[a-z]+
 { toplevel=$MATCH }

 PATH=/$toplevel/binaries:$PATH # you don't want to drop all the other
        # directories that were already in the PATH, do you?

Another possibility would be that you could tell the architecture by the
hostname, since you would know which OS runs on which machine.

 :0
 * HOST ?? host1|host5
 { toplevel=sun4 }
 :0E
 * HOST ?? host2|host3
 ( toplevel=netbsd }
 :0E
 * HOST ?? host4
 { toplevel=linux }

or something like that.

<Prev in Thread] Current Thread [Next in Thread>