开发者

Custom installation directories

开发者 https://www.devze.com 2022-12-22 21:41 出处:网络
Let\'s say I am writing installation script for the program which contains executable file and shared library. By default, this script places executable to /usr/local/bin, and shared library to /usr/l

Let's say I am writing installation script for the program which contains executable file and shared library. By default, this script places executable to /usr/local/bin, and shared library to /usr/local/lib. In this case my program may be executed by any user by typing its name in the command line.

S开发者_如何转开发uppose that user selects custom installation directory, like ~/myprogram/. Is it user's responsibility to ensure that my program may be executed, or my installation script must do this?


Normally the "make install" or installation script uses the install command to copy the file and set permissions (including the execute bits).

The install process should either append any new (i.e. if it doesn't already exist) directories to use for shared libraries, or tell the user what needs to be added. Such as the case if the program is install in a directory not already listed in /etc/ld.so.conf or in a conf file in directory /etc/ld.so.conf.d/.

For reference the two major packaging guidelines that you can refer to are the Linux Standard Base, and the Debian Policy Manual.

I hope that answers your question.


It is going to depend on whether your installer is run by root.

If the software is installed in /opt/myprogram, then everyone might use it and it would be semi-appropriate to fix /etc/ld.so.conf (or its equivalent) so anyone can use it.

Under an individual's home directory, or when the installer is not run by root, the best you can do is say "Add ~/myprogram/lib to LD_LIBRARY_PATH".

If there's an environment variable you can use to identify the install location, then you could install a script that ensures LD_LIBRARY_PATH is set in ~/myprogram/bin, which then runs the executable with the environment set. The might be in ~/myprogram/libexec, if I remember the FHS correctly1.


1 The libexec directory does not appear to be mentioned in the FHS. It is commonly used in the autoconf and related GNU installation systems.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号