As some of you will be aware from other threads, I have been
spending way too much time looking at the way that the LFS
book goes about creating its directory hierarchy, but for those
of you who find these things interesting, here's some more.

Here's what the current (r12002) book does, as regards creating
the required directory hierarchy, in two separate parts:

4.2

mkdir -pv $LFS/{usr,lib,var,etc,bin,sbin}
case $(uname -m) in
  x86_64) mkdir -pv $LFS/lib64 ;;
esac

mkdir -pv $LFS/tools


4.3

chown -v lfs $LFS/{usr,lib,var,etc,bin,sbin,tools}
case $(uname -m) in
  x86_64) chown -v lfs $LFS/lib64 ;;
esac


7.2

chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools}
case $(uname -m) in
  x86_64) chown -R root:root $LFS/lib64 ;;
esac


7.5

mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
mkdir -pv /{media/{floppy,cdrom},srv,var}
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
install -dv -m 1777 /tmp /var/tmp
install -dv -m 0750 /root

mkdir -v /var/{log,mail,spool}
ln -sv /run /var/run
ln -sv /run/lock /var/lock
mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}


Leaving aside the non-alphabetical ordering of the directories
in the Chapter 4 commands,

I wondered why the first two lines of commands in 7.5 duplicate
the creation, in 4.2, of

/bin
/var

but not any of the other "top-level" directories from 4.2, so

/etc /lib /lib64 /sbin /usr

that get created in 4.2?

I do note though that /etc, /lib and /usr are implicitly created
when subdirectories of them are, so could ask a slightly different
question, vis:

Why is the creation of /sbin not duplicated?


I also wondered why the first mkdir for subdirectories of /var

mkdir -v /var/{log,mail,spool}

doesn't have a "-p", in common with all the other mkdir-s,
including the creation of the top-level directories.

I'd suggest that the 7.5 commands would be better laid out as


Create some root-level directories that are not in the limited set
required for Chapters 4, 5 and 6.

mkdir -pv /{boot,home,mnt,opt,srv}

Create the required set of subdirectories below the root-level

mkdir -pv /etc/{opt,sysconfig}
mkdir -pv /lib/firmware
mkdir -pv /media/{floppy,cdrom}
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
mkdir -pv /var/{cache,local,log,mail,opt,spool}
mkdir -pv /var/lib/{color,misc,locate}

ln -sv /run /var/run
ln -sv /run/lock /var/lock

install -dv -m 1777 /tmp /var/tmp
install -dv -m 0750 /root


in that it would

1) remove the duplicated creation of /bin and /var, which
    are already referred to in 7.2
2) make the new/extra top-level directories more apparent
    by separating them out
3) be consistent in its use of "-p"


I might even be tempted to add /media into the first of those
mkdir lines, as its creation, in passing, as an implicit part
of the

mkdir -pv /media/{floppy,cdrom}

line might otherwise be lost on the reader.


I should also add that if the book really wants to ensure that all of the
top-level directories chown-ed to root:root in 7.2 have not somehow
"been lost" when entering the chroot, we explicitly duplicate their creation
in 7.5, with a note to that effect, but include /sbin in the list.

Hoping there's something there for someone,
Kevin
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to