Preferred location for binary


Forum: myDSL Extensions (deprecated)
Topic: Preferred location for binary
started by: WoofyDugfock

Posted by WoofyDugfock on Mar. 22 2005,08:20
I can place the binary for an extension I'm making anywhere provided the directory is in the command path.

Is there a preferred location in terms of conforming with linux standards? Does it matter whether it is put in /usr/local/bin or /usr/bin?  I'm wondering what they mean by "local" anyway (as in "locally installed software" - everything that's not a base install?)  Looking at the location of binaries from a few dsl's, they seem to be all over the place.

(I take it you wouldn't usually put it in /bin).

Posted by mikshaw on Mar. 22 2005,14:59
Technically it doesn't really matter as far as the enduser is concerned, but typically installed apps are put into /usr/local or /opt so that system updates don't mess with them.  You can actually put binaries anywhere you want, even if it's not in your path.  It's just more convenient and organized to follow the standard hierarchy.
< http://www.pathname.com/fhs/ >

Posted by WoofyDugfock on Mar. 22 2005,15:10
Thx - some late night reading some time.

(The binary per se needed to be in the command path in this case  because it's a commandline app).

Posted by mikshaw on Mar. 22 2005,15:48
It's always most convenient to put executables into /usr/bin or /usr/local/bin, but if it is not possible for some reason (for example, if you create a tar.gz or uci extension), there are a few things you can do to work around it:

1) use the full path to the executable:
/opt/something/bin/executable
2) add the directory to your $PATH variable:
PATH="/opt/something/bin:$PATH"
3) create a symlink to the file in a directory which is already in your path.

I often do a combination of the 2nd and 3rd options.  I have a bin directory in $HOME, which is added to my path.  If there are executables not in my path I link them into that bin directory.
This saves having a great long string for $PATH

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.