On a serious note, what I'd change about FreeBSD hier(7)
freebsd at edvax.de
Wed May 13 14:39:37 UTC 2020
On Wed, 13 May 2020 19:21:24 +0530, Manish Jain wrote:
> On 2020-05-13 17:21, @lbutlr wrote:
> > On 12 May 2020, at 23:33, Manish Jain <bourne.identity at hotmail.com> wrote:
> >> Perhaps you might like to remember another location : /opt
> >> That is entirely unused in the default config in FreeBSD, and I think /opt/bin makes a good location for the user's own software.
> > User software goes in ~/bin. Admin user’s software that is used by the system goes in /usr/local/bin.
> > I see no need for /opt/bin, what would you put there?
> User software goes into ~/bin - that's right but with a caveat. What
> goes into ~/bin is user-specific.
> If I wrote a system-wide application intended to be available to all
> users of this particular computer, /opt/bin would make a good choice.
Exactly! Whatever happens in ~/bin is local to the user, and
no other user can (per default) access software installed to
that place. A special case is /root/bin where the system
administrator can keep helper scripts that are not interesting
to anyone else.
If your program is not managed using the ports collection, but
you simply compile it yourself, putting it into /opt/bin is a
very convenient approach, especially if all users have a $PATH
that includes that non-standard executable directory.
The location /opt/bin is also very good for programs that have
non-standard naming and structure for their "non-managed"
installation. For example:
/opt/foo -> directory where it's located
/opt/foo/program/foo -> the actual executable
/opt/foo/assets/ -> various program components
/opt/foo/temp/ -> a non-standard temporary storage
/opt/bar -> again, program's base directory
/opt/bar/labar.sh -> the executable (a launcher script)
/opt/bar/stuff.dat -> program data
/opt/bar/blah.txz -> further program data
/opt/bar/baz.zip -> even more program data
For convenient "program starters":
/opt/bin/foo@ -> /opt/foo/program/foo
/opt/bin/bar@ -> /opt/bar/labar.sh
Now users can execute "foo" and "bar". In case a specific
"preparation" is needed, the symlinks can be replaced with shell
scripts that can, for example, set certain environment variables,
create required dummy files or even change permissions if needed;
they can also do "clean up" after the program terminated.
As you can see, /opt, as it is not "regulated", can deal with
"flat layouts", "custom trees" and anything just fine. :-)
> It's of course merely a suggestion, but does help to keep /usr/local/bin
> cleanly reserved for what gets installed via pkg/ports.
Yes. That is the lesson of "man 7 hier". :-)
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions