- add '-D ${DESTDIR}' to INSTPRIV, so install(8) removes the leading
${DESTDIR} from the metalogged path
- provide ${METADB.add} variable (for "${CAT} -l >> ${METALOG}"), to make
it easier to replace manual metalog manipulation in the future.
- with manual metalog additions, don't add the leading ${DESTDIR} in the path
- in maketars, use "mtree -C ..." instead of
"mtree -D ... | sed -e 's,\(.*\) \(\..*\),\2 \1,";
Benefits:
- maketars "Parsing METALOG" step speeds up from 29 seconds to 1.2 seconds
on a P3-600.
(This also benefits "make installworld" at the top level.)
- ${DESTDIR}/METALOG is easier to read without the leading "${DESTDIR}"
on all the pathnames, and it's smaller as well.
or the command with an interactive question. (This also prevents
weird problems if a directory element of '-f path' is missing and
'make -j N' is being used).
- add "-N etcdir", to be used for pax & mtree -N. defaults to ${DESTDIR}/etc
Makefile:
- if UNPRIVED, call maketars with "-N ${NETBSDSRCDIR}/etc", so that
"make UNPRIVED= DESTDIR=/foo installsets" can work with an empty
${DESTDIR}/etc. (i.e, after a make build without install-etc-files)
instead of creating tar files. If the default sets are used, "etc" is
removed from the list, because it's highly unlikely that it's wanted
in that case.
Tested against a DESTDIR created with "make UNPRIVED= DESTDIR=.... build".
- improve munging of NetBSD.dist and METALOG into metalog, using mtree to
"cleanup" / "merge" entries, and don't sort the result.
relies upon mtree to not change the order (see below)
- use (newly added) join.awk to output lines in metalog that are listed
in flist.${set}. join.awk doesn't require either file to be sorted
(unlike join(1)), which is required because we want to retain the
order of the metalog, because certain entries in the metalog (such
as hard links) make assumptions about the permissions of earlier entries.
this should fix [toolchain/16207]
- read NetBSD.dist from ${DESTDIR}/etc/mtree instead of /usr/src/etc/mtree
- run mtree with "-N ${DESTDIR}/etc" instead of using the host user databases
contain the correct permissions.
Makefile:
- set SETSENV to the list of variables we wish to pass to each shell
script and use that, rather than duplicating the effort below
- call maketars with "-M ${METALOG}" if UNPRIVED is set.
getdirs.awk:
- takes a list of filenames and outputs the list along with all the
directories used by those filenames
maketars:
- support "-M metalog"
- merge etc/mtree/NetBSD.dist with the "-M metalog" for use in the tgz build
- for a given set, find the union between the set list and the metalog
generated above and use that as the list of files to ${PAX} up as the
tgz file.
attempted to be created.
This way, in "discover missing files" mode, you'll get the benefit
of getting all the missing files listed before this script bombs
out with a non-zero exit status, something which can be of benefit
on slow machines.
mode with no options and no parameters.
You have to be careful about the difference between $@ and $*.
In particular, "if [ -n "$@" ]" does not do what you think it will.