Commit Graph

61 Commits

Author SHA1 Message Date
apb d6b37f8359 No space in "function()", "command;" or "$(command)".
Requested by christos.
2006-01-28 19:01:23 +00:00
apb c32228d46e When printing messages to stderr, always use
echo >&2 "${prog}: ..."

Approved by christos
2006-01-08 10:10:03 +00:00
apb 29e51821aa Remove the code that used "${MTREE} -C ..." to sanitise the plist. We
can now assume that it's already been sanitised before maketars was
invoked.

Reviewed by agc
2006-01-04 15:03:39 +00:00
apb 0bee96eab7 Ensure that (almost) all shell variables in distrib/sets/* scripts are
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
2006-01-03 18:31:09 +00:00
apb 3a0b541193 Add shell variables defined in sets.subr for almost all commands used
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.
2006-01-03 16:40:16 +00:00
apb 26d8593b50 Move default values for several shell variables into sets.subr.
Reviewed by agc
2006-01-03 15:42:42 +00:00
jmc d5bf52b805 Set default vars so blank and unset both end up w. a reasonable default 2005-10-21 02:41:14 +00:00
erh 10d0173282 Make all the sets scripts work even when not run from the directory that
they reside in.
Change any uses of dirname to use shell variable substitution instead.
2004-07-23 15:11:26 +00:00
dsl eb5d4e583d Write to a temporary file and mv to real name to avoid getting a
truncated file if/when interrupted.
2004-04-18 19:52:32 +00:00
dyoung c3ca61a258 Clearly the error message was supposed to print $metalog, not
$METALOG.
2004-02-19 02:54:51 +00:00
lukem 5a4b1f5af4 When not using a metalog, only copy the generated flist.<set> over
/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.
2004-02-06 11:38:57 +00:00
lukem 1c401bb3d7 Create ${DESTDIR}/etc/mtree/set.<setname> setfiles for each given <setname>.
Add `-S' to exit after creating the setfiles.
Send errors to stderr instead of stdout.
2004-01-30 08:39:50 +00:00
lukem 024e4b2926 Also remove "xetc" from the default list of sets copied with -i installdir 2004-01-29 08:32:51 +00:00
lukem 6f9a1982b5 rename all the <bsd.own.mk> derived variables to uppercase, and export
them to the environment.
2004-01-03 02:38:58 +00:00
lukem b852db83fb Significant overhaul of how the sets are used:
* 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).
2003-12-29 03:13:25 +00:00
jmc 62fcaffaa9 Redo creation of sets/sums so this can be parallelized if using -j.
Suggested in PR#20115 and PR#20116
2003-12-19 22:25:53 +00:00
dyoung 17b5668ccd Factor duplicated code for setting variables such as machine_cpu
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.
2003-11-25 07:19:46 +00:00
dsl 11dc7d2a0b Report correct error code (in particular when mtree objects to METALOG file). 2003-10-16 14:20:20 +00:00
lukem 9eb4566d27 * use ${MKTEMP} -d instead of home-grown tempdir creation code
* use $(...) instead of `...`
* fix a recent modification to follow the same coding style as the
  rest of the file...  (mmm, consistency)
2003-09-30 05:07:40 +00:00
dsl 9d055a33fc Since the METALOG is updated by every install, there is no need to
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.
2003-08-22 19:08:47 +00:00
lukem ed18469ce3 if the mtree parse of METALOG fails, exit. 2003-07-03 06:43:02 +00:00
perry 2c736e195a Temporarily revert last. It now screws over symlinks from the destdir,
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.
2003-04-07 17:22:19 +00:00
perry 1b49023f24 do pax -L so that symlinks aren't blown away.
Beginning of work to fix PR install/8090 from Luke Mewburn
2003-04-06 19:41:03 +00:00
erh f3281c94bd Return the correct exit status in the trap handler so errors get caught.
Also make sure the status is less than 256.
2003-01-21 19:07:05 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
lukem 245a0c292b improve description of -t 2003-01-03 15:26:32 +00:00
lukem 7f4e9b543c improve description 2002-12-25 23:47:32 +00:00
lukem 12837cbb48 fix header to match usage 2002-12-25 23:44:06 +00:00
lukem 144b55005f Rework METALOG manipulation:
- 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.
2002-12-23 06:52:48 +00:00
lukem d9aa9519e8 Invoke ${PAX} with '-O' so that various errors don't hang the make
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).
2002-12-21 15:54:48 +00:00
lukem a4a6515a36 Always call maketars (and subsequently pax) with -N ${NETBSDSRCDIR}/etc,
so that we always use the user & group databases from there rather than
the host systems.
2002-12-19 12:33:10 +00:00
lukem e629b6c337 maketars:
- 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)
2002-12-19 06:21:45 +00:00
lukem 27015a09a7 consistently use $dest instead of $DESTDIR 2002-12-17 01:59:32 +00:00
lukem 25193201ba Add '-i installdir', to copy the given sets from $DESTDIR to installdir
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".
2002-12-12 08:51:49 +00:00
lukem 62148d5f92 use ${make} instead of ${MAKE} in the shell scripts, to prevent weird
lossage with the modified ${MAKE} getting passed to child make's
2002-11-26 06:22:22 +00:00
lukem 8fa5df2d2d explicitly add " -f `dirname $0`/Makefile " to ${MAKE}, so that
these scripts do not need to be run from this directory in order
to function correctly
2002-11-25 23:29:54 +00:00
lukem c64952588e set MAKE="${MAKE:-make} -j 1" to prevent problems where the output
of make -j N>1 would result in junk in various shell variables
2002-07-23 09:02:45 +00:00
lukem 86d7ecae0d keep separate temp files for "full" flists 2002-05-19 13:24:22 +00:00
lukem 828711201d - clean up SDIR (temporary directory) creation
- 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]
2002-04-13 12:47:10 +00:00
tron 7547e52684 Solve problem with with XFree86 3.3.6/4.x set "maketars" differently:
We don't want e.g. a seperate "xbase.tgz" and "xbase3.tgz" but one
combined archive.
2002-04-08 17:18:22 +00:00
tron 9ee8792ae0 Fix problem with building X11 release "tar" archives after support for
XFree86 4.x sets has been added. Problem noted by Richard Earnshaw in
private e-mail.
2002-04-08 15:39:32 +00:00
bjh21 fe26e66da4 Instead of using mktemp -d (which isn't available on many systems), use mkdir
in a loop to create a temporary directory.  Add a few chacks for the sanity
of /tmp first, so as to avoid making the loop infinite.
2002-04-01 15:50:30 +00:00
lukem a5fc5a8af0 - use numeric rather than symbolic trap names; it's more portable
- 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
2002-03-01 07:21:14 +00:00
lukem c71e0408fb Fixes to allow unprivileged building of the binary tar files to
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.
2002-02-27 10:51:47 +00:00
he e0e10bde3f Wait with exiting on error until all the install sets have been
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.
2002-02-26 20:03:08 +00:00
thorpej 35a01e1ce7 Use the logic in bsd.own.mk to determine machine/machine_arch. 2001-11-24 03:08:27 +00:00
jmc 37a2db8a6c Change pipeline in sets building so proper error detection for each stage
can be detected. This way sets stop building at the exact file that doesn't
exist rather than continuing.
2001-01-22 07:03:44 +00:00
thorpej d01921b990 Add the xmisc set. 2000-10-01 22:49:05 +00:00
itohy d2ebbdebdc Use "$MAKE" instead of "make" for cross environment. 1999-02-13 07:59:45 +00:00
frueauf aa66b9fc72 Use $out correctly, pointed out in pr 6526 by Dave Huang. 1998-12-03 18:17:45 +00:00