Place to install library of shell functions
Polytropon
freebsd at edvax.de
Tue Apr 5 15:58:21 UTC 2011
On Tue, 05 Apr 2011 17:23:47 +0200, Michael Grünewald <michaelgrunewald at yahoo.fr> wrote:
> Dear FreeBSD users,
>
>
> today I come to you with what seems to be somehow pedantic question:
> where is the best place to install libraries of shell functions.
Depends. Are you interested in shell functions you install
from a port / package, or your own shell functions?
> I read hier(4) carefully and it seems the correct place for this would
> be somewhere under `/usr/local/share':
>
> share/ architecture-independent files
This structure usually serves the purpose of /usr/share,
but for software installed by ports or packages, as the
/usr/local/ subtree "duplicates" the system's structures
in many cases.
> On the base systems, many macros (make templates and groff macros) are
> actually installed under /usr/share. However, the only library of shell
> functions I am aware of is `/etc/rc.subr', that landed on this funny
> location, probably to be pretty sure that this library is on the same
> filesystem as the scripts under /etc/rc.d.
I guess that's the intention behind this decision. You'll
see that many things on FreeBSD are determined by a well-
intended thought, rather than an arbitrary "Oh, why don't
we just put it ... *throw a dice* ... here?"
> Several of the ports install shell scripts under `/usr/local/lib' that
> hier(4) devotes to ``shared and archive ar(1)-type libraries''. These
> shell scripts are:
>
> > find /usr/local/lib -name '*.sh'
> /usr/local/lib/tk8.5/tkConfig.sh
> /usr/local/lib/seamonkey/run-mozilla.sh
> /usr/local/lib/libxul/run-mozilla.sh
> /usr/local/lib/rpm/convertrpmrc.sh
> /usr/local/lib/rpm/find-lang.sh
> /usr/local/lib/rpm/getpo.sh
> /usr/local/lib/rpm/u_pkg.sh
> /usr/local/lib/rpm/vpkg-provides.sh
> /usr/local/lib/rpm/vpkg-provides2.sh
> /usr/local/lib/firefox/run-mozilla.sh
> /usr/local/lib/tcl8.5/tclConfig.sh
> /usr/local/lib/thunderbird/run-mozilla.sh
> /usr/local/lib/llvm-gcc-2.8/gcc/x86_64-portbld-freebsd8.2/4.2.1/install-tools/fixinc.sh
>
> Two files (the `/usr/local/lib/tcl8.5/tclConfig.sh' one and the
> `s/tcl/tk/g' one) are actually shell script libraries (defining a bunch
> of variables), and all the others are ancillary scripts, that would
> maybe better fit in `/usr/local/libexec'.
It depends on where the respective port maintainer want to
have them.
> So, practical experience does not really second my a priori that these
> files sould go under the `share' hierarchy and I would like to have your
> opinion on this question.
Many software is ported from Linux, so their structures,
or sometimes the lack of, is applied.
For example, I put _my_ stuff that is NOT managed by ports and
definitely does NOT belong to the system into an /opt subtree,
a Solaris-ism I'm "abusing": /opt/bin is in $PATH, so anything
system-wide executable is located there, and /opt/share
does contain non-executable shell scripts (e. g. those with
helper functionalities) or files with settings (that are
sourced by something else) - things that usually are not
called directly.
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions
mailing list