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

Re: debian package installation - setting environment

Hi Ivars,

Ivars Strazdins wrote:

> This seem to be appropriate mailing list, please advice, if not.

Unless you are talking about creating a Debian package, you probably
will get more advice on debian-user.  The rest of my reply below assumes
that you are in fact creating a Debian package out of third-party
software.  In that case, the first thing to ask yourself is -- do you
eventually want to see the package (a) in the official Debian archive,
(b) otherwise publicly or commercially available, or (c) is it for
personal or internal use only?  In case (a), there are a lot of
stringent requirements ("Debian Policy") on the locations of files in
the package.  In case (b) or (c), you can do as you want, but I would
recommend that publicly available third-party software built as a Debian
package try to obey Debian Policy as much as possible to reduce user

> how do I set/change system wide environment variables when installing
> package?

Unfortunately (or fortunately, depending upon your viewpoint) Debian
doesn't have any method of setting environment variables for all users.
This is partly because it's forbidden by Policy, and partly because
it's a non-trivial problem (you don't know what shells the users are
using, etc.)  The only guaranteed way to run a binary with a given set
of environment variables set is to write a wrapper script around the
binary, and export the variables in the wrapper.

> The package should go to /opt/<packagename>. I've been reading a lot
> of fighting about /opt for packages.

There is no fight -- official Debian packages may not use /opt.
Third-party packages installed in some other way certainly may, but
again I would recommend that unofficial Debian packages conform to
Policy as much as possible so as not to confuse users.

> Anyway, this seem to be the right place for 3rd party packages. Also,
> I cannot change this decision anyway :(

Why -- is it closed-source software?  Never mind, I just saw your second

> It is hard coded into management decision to which I really have no 
> access whatsoever.

Someone should tell management that Debian users will be happier to
use the package if it conforms to expected behavior for Debian
packages :-)

> So, I need at least to add /opt/<package>/bin to $PATH + maybe 
> setting some other environment variables (creating a wrapper script 
> in $PATH is another possibility). How do I do this?

If management will not change its mind about the packaged files going
into /opt, it seems to me that putting wrapper scripts into /usr/bin or
/usr/sbin (or /bin or /sbin if you need the software available early in
the boot process) is your only option.

best regards,

Kevin B. McCarty <kmccarty@princeton.edu>   Physics Department
WWW: http://www.princeton.edu/~kmccarty/    Princeton University
GPG: public key ID 4F83C751                 Princeton, NJ 08544

Reply to: