Re: [lfs-dev] More observations on directory creations

2020-08-01 Thread Pierre Labastie via lfs-dev
On Sat, 2020-08-01 at 16:16 -0500, Bruce Dubbs via lfs-dev wrote:
> 
> 
> All mkdir commands should use -p whether needed or not, just for 
> consistency.

I'm not sure that "consistency" is the right word here: using an option
consistently means using it when it is needed...

Maybe "regularity" or so.

> An exception can be made for mkdir -v build instructions 
> where needed.
> 
> I think the entire directory tree should continue to be specified in 
> Section 7.5. Creating Directories

Why? I'm more and more thinking that with the new layout, the place for
"creating directories" is in chapter 4.

> but adding a note that some of the 
> directories have already been created by commands earlier in the book
> or 
> by earlier package install instructions, but are repeated for 
> completeness and do not affect existing directories.

Pierre

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

Re: [lfs-dev] More observations on directory creations

2020-08-01 Thread Bruce Dubbs via lfs-dev

On 8/1/20 9:20 AM, Pierre Labastie via lfs-dev wrote:

Hi,
Exceptionally top-posting, because, I'll answer in the message body,
and I want to tell general things first.
First, thanks to Kevin to be our "quality assurance". Those messages
are bugging me, but make me think...
Second, presently, the whole management of directories is the result of
design decisions made at the beginning of the testing of the new
method. Some of those decisions may seem wrong now, but that was not
evident at the time. Specially, the first aim was to have a working
build, not necessarily the best explanations...
Third, one of those decisions was to keep $LFS owned and only writable
by root. At the time, it was thought that it could prevent unwanted
behavior in chapter 6, for example alert on non desirable directory
creation. In retrospect, it was maybe not necessary, and having $LFS
writable by lfs could simplify things a lot.
That said, here are a few comments...

On Sat, 2020-08-01 at 15:42 +0800, Kevin Buckley via lfs-dev wrote:

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}


the order is a result of adding directories as needed for chapter 6
installations. They did not come in alphabetical order. Now they can be
sorted...


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}


alphabetical sort here too.


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}


and here again


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}


At first, /bin was not used in chapter 6. Now it is, and shouldn't
appear here.
/etc, and /lib already exist. the -p option is not needed


mkdir -pv /{media/{floppy,cdrom},srv,var}


Again, /var was added later in the minimal set. May be removed here.
/media does not exist yet, so the -p option is needed.


mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}


Here, we should separate /usr and /usr/local:
/usr/{bin,include,lib,sbin} exist from chapter 6. The equivalent in
/usr/local does not. OTOH, we may want to have the whole structure in
one place (which means probably adding sbin to the first line)


mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}


Again, some of those already exist from chapter 6


mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}


Same here (terminfo)


mkdir -pv /usr/{,local/}share/man/man{1..8}


And again here


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


answered above...



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

/etc /lib /lib64 /sbin /usr


with mkdir -p, those directories would be created if they did not
exist. But I agree, /var could be left for later, when creating
subdirectories in /var (using mkdir -p)



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?


Good question. Having the whole directory structure on one page might
be better for understanding. I (and Thomas) wonder whether this
structure couldn't even be created in chapter 4, selectively changing
ownership of directories where the lfs user needs to be able to write.



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.


It does not have a -p because it is not needed. But then the first line
does not need it either... Not very consistent, as you say.



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/

Re: [lfs-dev] More observations on directory creations

2020-08-01 Thread Ken Moffat via lfs-dev
On Sat, Aug 01, 2020 at 04:20:54PM +0200, Pierre Labastie via lfs-dev wrote:
> 
> > 
> > Hoping there's something there for someone,
> 
> Sure! At least for me (and Thomas)
> 
> Pierre
> 
+1

ĸen
-- 
Juliet's version of cleanliness was next to godliness, which was to
say it was erratic, past all understanding and was seldom seen.
  -- Unseen Academicals
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Re: [lfs-dev] More observations on directory creations

2020-08-01 Thread Pierre Labastie via lfs-dev
Hi,
Exceptionally top-posting, because, I'll answer in the message body,
and I want to tell general things first.
First, thanks to Kevin to be our "quality assurance". Those messages
are bugging me, but make me think...
Second, presently, the whole management of directories is the result of
design decisions made at the beginning of the testing of the new
method. Some of those decisions may seem wrong now, but that was not
evident at the time. Specially, the first aim was to have a working
build, not necessarily the best explanations...
Third, one of those decisions was to keep $LFS owned and only writable
by root. At the time, it was thought that it could prevent unwanted
behavior in chapter 6, for example alert on non desirable directory
creation. In retrospect, it was maybe not necessary, and having $LFS
writable by lfs could simplify things a lot.
That said, here are a few comments...

On Sat, 2020-08-01 at 15:42 +0800, Kevin Buckley via lfs-dev wrote:
> 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}

the order is a result of adding directories as needed for chapter 6
installations. They did not come in alphabetical order. Now they can be
sorted...

> 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}

alphabetical sort here too.

> 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}

and here again

> 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}

At first, /bin was not used in chapter 6. Now it is, and shouldn't
appear here.
/etc, and /lib already exist. the -p option is not needed

> mkdir -pv /{media/{floppy,cdrom},srv,var}

Again, /var was added later in the minimal set. May be removed here.
/media does not exist yet, so the -p option is needed.

> mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}

Here, we should separate /usr and /usr/local:
/usr/{bin,include,lib,sbin} exist from chapter 6. The equivalent in
/usr/local does not. OTOH, we may want to have the whole structure in
one place (which means probably adding sbin to the first line)

> mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}

Again, some of those already exist from chapter 6

> mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}

Same here (terminfo)

> mkdir -pv /usr/{,local/}share/man/man{1..8}

And again here

> 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

answered above...

> 
> but not any of the other "top-level" directories from 4.2, so
> 
> /etc /lib /lib64 /sbin /usr

with mkdir -p, those directories would be created if they did not
exist. But I agree, /var could be left for later, when creating
subdirectories in /var (using mkdir -p)

> 
> 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?

Good question. Having the whole directory structure on one page might
be better for understanding. I (and Thomas) wonder whether this
structure couldn't even be created in chapter 4, selectively changing
ownership of directories where the lfs user needs to be able to write.
> 
> 
> 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.

It does not have a -p because it is not needed. But then the first line
does not need it either... Not very consistent, as you say.

> 
> 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,

[lfs-dev] More observations on directory creations

2020-08-01 Thread Kevin Buckley via lfs-dev
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