Subject: install -d -c or maybe makefile

From: [email-masked] (Larry Lee)

There has been some discussion recently about install -d -c features
or lack thereof.

I have been trying to get a complete build to work from within a chroot'd
environment.  Clearly to do this it is necessary to seed the environment
with the sources from the tar files as well as all the compilers etc.

I have discovered that many target directories must previously exist.
One example is the /usr/share/man/cat[0-8] directories are not created
by any make directive that I have found. I presume that these target
directories were created by an install of the binary tar files.

As a point of discussion, and not a bug report or change request,
would it not be appropriate to change most 'install' commands in the
makefiles to 'install -d'.  In this way the makes would create the
required target directory structure, and only those directories that
are required. As a result it would be much more convenient to allow
both the -d and -c directives on a single line.

Larry

---

From: [email-masked] (J.T. Conklin)

> both the -d and -c directives on a single line.

At one time, many of the makefiles had "install -d" commands in the 
install targets so that directories were created.  This was changed when 
we found that the "mtree" files (in src/etc/mtree/*) conflicted with the 
user and group ownership or file permissions set in the makefiles.  Since 
it is easier to maintain one set of mtree files compared to several 
hundred makefiles, we decided that mtree would be used to create any
needed directories.

All you should need to do to create missing directories and to fix 
incorrect ownership and permissions is to make "distrib-dirs" (or something 
like that) in ~/src/etc.

As to why I think "install -d -c" is a bad idea: How often will the
directory and the file you are installing share exactly the same ownership
and permissions?  And how difficult is it to and an additional line to the
makefile so it is clear that both a directory is to be created and a file 
is to be installed?

	--jtc

---

From: [email-masked] (Larry Lee)

>You should look at the methods used to build snapshots, etc., found in
>/usr/src/etc/Makefile.  You want to use the 'mtree' program.

Thank you.

---

From: [email-masked] (Larry Lee)

>makefile so it is clear that both a directory is to be created and a file 

You make an excellent point for the NetBSD system taken as a whole.
I like simple, kinda keeps things at my level. 

There is also discussion about the installation (and deinstallation) of
packages. One of the side benefits that I hope comes from that discussion
is that what is currently NetBSD will be divided into several smaller
packages.  Would you recommend the mtree solution for the average 
installation package? Would mtree be appropriate for X?

Larry

---

From: [email-masked] (J.T. Conklin)

> installation package? Would mtree be appropriate for X?

I would think that a good package installation/deinstallation facility
would use files like what mtree produces.  They would contain the names of
all of the files, their ownership and permissions, and possibly their
dates and checksums.  SCO's custom utility had them, and a program called
"fixperms" which would change file's uids, gids and permissions to match
those recorded in the file.  The POSIX.7.2 draft has a similar scheme. 

	--jtc