[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PW#5-10: System-wide environment variables used for program config



schwarz@monet.m.isar.de (Christian Schwarz)  wrote on 13.01.98 in <[🔎] 199801132234.XAA04238@klee.painters.schwarz-online.com>:

>      No program may depend on environment variables to get reasonable
>      defaults. (That's because these environment variables would have
>      to be set in a system-wide configuration file like /etc/profile,
>      which is not supported by all shells.)
>
>      If a program should depend on environment variables for its
>      configuration, the program has to be changed to fall back to a
>      reasonable default configuration if these environment variables
>      are not present.
>
>      Furthermore, as /etc/profile is a configuration file of the bash
>      package, no other package may include any environment variables or
>      other commands in that file.

If program foo expects the environment variable BAR=/var/lib/fubar, an  
easy way to make it comply to this policy is to rename foo to foo-real,  
and write a wrapper shell script

           #! /bin/sh
           BAR=/var/lib/fubar
           foo-real "$@"

[I hope I got that right!]

NOTE: This may not work if the program decides what to do based on the  
name it is called with. Fortunately, this is rare.

MfG Kai


Reply to: