The FHS says:
The directories /opt/bin, /opt/doc, /opt/include, /opt/info, /opt/lib,
and /opt/man are reserved for local system administrator use.

and then says:
Programs to be invoked by users must be located in the directory
/opt/<package>/bin or under the /opt/<provider> hierarchy.

So the opt heirarchy we are creating is basically a 4th sbin (/sbin,
/usr/sbin, /usr/local/sbin, /opt/bin). This seems silly to me, and is
*not* a requirement of the FHS. The only requirement is that if a
user-run program is in opt, it must be in /opt/<package> which is beyond
LFS.

The next glitch is /etc/opt

The FHS says:
Host-specific configuration files must be installed in /etc/opt. See the
section on /etc for more information.

but then goes on to say:
Generally, all data required to support a package on a system must be
present within /opt/<package>, including files intended to be copied
into /etc/opt/<package> and /var/opt/<package> as well as reserved
directories in /opt.

which means that the package 'foo', if installed into /opt, must be
installed into /opt/foo. And if it has an etc-like config file, it must
exit in *both* /opt/foo/<non-dictated-path>/foo.rc and /etc/opt/foo.rc.
This is silly. BLFS doesn't follow either rule that I'm aware of. They
use /etc/foo/foo.rc.

What it boils down to is this: Any directory creation beyond
/{etc/,var/}opt is nothing more than a 4th sbin and is *not* required by
the FHS, nor is it used in BLFS. I recommend we stop creating them and
allow them to be what the FHS calls "reserved for local system
administrator use" which I read as "if the sysadmin wants them, that
sysadmin creates them."

Now, on to my proposed re-worked directory creation commands:


mkdir -pv /{bin,boot,etc/opt,home,lib,mnt,opt}
mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
mkdir -v  /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
for dir in /usr /usr/local; do
  ln -sv share/{man,doc,info} $dir
done
mkdir -v  /var/{lock,log,mail,run,spool}
mkdir -pv /var/{opt,cache,lib/{misc,locate},local}


This shaves off 6 lines and showcases:
- both {a,b} and {1..8} expansion of varying complexity
- how to use install when the default creation mode is not wanted
- a simple for loop
- mkdir's -p switch (or lack thereof)


If the full /opt heirarchy just has to be kept, it can easily be
compressed to one line.

mkdir -pv opt/{bin,doc,include,info,lib,man/man{1..8}}


-- 
Archaic

Want control, education, and security from your operating system?
Hardened Linux From Scratch
http://www.linuxfromscratch.org/hlfs

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to