used with curly braces and quotes, as in "${var}".
Also ensure that command substitution is quoted, as in "$(command)", and
convert `command` to $(command).
Reviewed by agc
by scripts in distrib/sets/*. This is intended to be useful when cross
building. Only trivial commands like echo, cat, and rm are excluded
from this treatment.
While I am here, make ${MTREE} and ${DB} follow the pattern used by most
other such variables.
Reviewed by agc.
/etc/mtree/set.<set> if they are different. This should allow
installsets to operate from a pre-populated read-only DESTDIR.
Based on fix from Juergen Hannken-Illjes.
* Add an optional third field to the sets file which is a list of
comma separated keywords that control if the line is printed.
Currently supported keywords
kerberos4 ${MKKERBEROS4} != no
kerberos ${MKKERBEROS} != no
lint ${MKLINT} != no
obsolete ${obsolete} != 0.
In this case, non obsolete files are not printed.
(This will allow future support for builds with variables such as
MKHESIOD and MKYP set to "no".)
* Use sh(1)'s getopts where appropriate, and otherwise cleanup the
various scripts.
* Move defaults for sets.subr from sets.defaults into sets.subr.
Move replicated code for determining stuff such as shlibs type
from various scripts into sets.subr.
* Merge the obsolete.*, krb.*, krb4.* and lint.* into the appropriate
main lists with the relevant third field keyword(s).
and machine_arch to their defaults into sets.defaults, and source
it at the top of each script.
Also, to be consistent with variable naming, s/arch/machine_arch/.
sets.defaults introduces two new variables, krb and krb4, which
will affect whether Kerberos- or Kerberos IV-only files are put
into the set lists.
remake the sets if the set files are newer than METALOG.
Useful for running DISTRIBUTION_DONE= nbmake in src/etc in order to
rebuild with new kernels and/or new ramdisk.
which is the inverse problem. It is fixable by piping one pax -w into
a pax -r instead of using a pax -rw, but unfortunately that won't work
yet because I've hit a pax issue. I'll fix that and then fix this right.
- 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.