Commit Graph

138 Commits

Author SHA1 Message Date
joerg 12929bba43 - When compiling nbinstall for the tool chain, use the target strip
and not /usr/bin/strip. This makes nbinstall usable for
  cross-compiling in pkgsrc.
- Fix a typo in a comment.
- Fix strip() in the context of (v)fork:
  - Build the argument string first using asprintf (simpler) and
    avoid leaking memory from the child in the parent.
  - Don't use warn in the child, as stdio should be avoided.

OK christos@, tested on Solaris by dmcmahill@.
2007-06-28 19:05:55 +00:00
bouyer 3697550e70 Don't depend on lubutil if we're building host tools. Fix tools build on
non-NetBSD hosts.
2006-12-16 12:59:16 +00:00
he 0a97c3f688 Complete the move of string_to_flags() and flags_to_string() from the
bin/ls sources to libutil:
 o Bump libutil minor version number
 o Fix uses to include <util.h> to pick up the function definitions
 o Fix most uses of flags_to_string() to release the now-malloc()ed result
2006-12-14 20:09:35 +00:00
christos 11c53ad61c kill crypto/rmd160.h and crypto/sha2.h, and instead make symlinks to
/usr/include from /usr/include/sys. This makes all the one way hash
header handling identical.
2006-10-30 20:22:53 +00:00
rillig e723f89fb8 When trying to copy many files into another file, provide a useful and
more specific error message instead of the usage().
2006-10-06 20:22:59 +00:00
daniel c43e654c14 PR/30698: install(1) stripping flags in METALOG [patch] (Jukka Salmi)
Apply patch, thanks!
2006-09-25 16:05:44 +00:00
daniel 3b6bc88204 PR/32589: install -d ignores existing non-directories (joerg@netbsd.org)
Raise an error if an argument to 'install -d' exists as a non-directory,
as suggested by joerg@ (and acked by some developers on #netbsd-code).
With this change behavior is equal in this respect to FreeBSD and
DragonFly.
2006-09-25 13:21:19 +00:00
dbj b41feff50f fixes for installing into a case insensitive $DESTDIR
when files may have hard links to a a name that only differs by case
  - change install to unconditionally remove its temporary file
    when installing hard links with -r.  This avoids problems when
    built with posix rename(2) semantics and reinstalling an existing
    hard link.
  - rework hard link targets in bsd.man.mk and bsd.links.mk
    to use makefile constructs instead of shell constructs
  - always reinstall hard links that may have case conflicts, even
    when MKUPDATE=yes, this ensures that they get added to METALOG
  - remove man pages which were hard linked to themselves in libform
  - remove improper hard link command for existing man page in libkrb5
  - fix libl's makefile to include bsd.lib.mk at end
  - remove shell quoting in link target for test's [.1 man page
2006-09-11 22:24:09 +00:00
mrg 982b2b7938 char -> u_char for a buffer passed to MD5*(). 2006-05-11 06:09:44 +00:00
christos 24f29ca641 Coverity CID 95: Fix resource leak. 2006-04-21 16:36:05 +00:00
christos c05266af8a fix setmode error handling. 2005-10-01 20:23:54 +00:00
elad 851adad0b8 Use crypto/rmd160.h. 2005-09-25 14:34:54 +00:00
christos cc6e13ee6e mktemp() uses are ok here, so no more warnings. 2005-06-11 22:59:05 +00:00
lukem 1282d958b8 When creating a relative symlink (-lr), use the originally provided `to_name'
to create and metalog, rather than using the realpath(3) modified version.
Fixes a problem with -lr when -ddestdir contains a symlink.

Add some XXX comments reminding us that the `from_name' in a symlink may
point outside of destdir in the metalog, even though our build process
doesn't trigger this.
2005-05-10 01:24:42 +00:00
lukem 980e24707e strvis(3) encode the link=... argument in the metalog.
(mtree(8) already requires this.)
2005-05-08 23:05:02 +00:00
lukem 19452aceea metadata_log(): remove leading -D destdir before strsvis(3) encoding
the path, not after.
2005-05-08 10:23:13 +00:00
jmc b2f782612f Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
2004-06-20 22:20:14 +00:00
lukem f0cea2f5e2 Fix bug when calculating digest when copying from dev/null.
Problem noted by Matthias Scheler and Tomasz Luchowski.
2004-02-02 23:25:36 +00:00
lukem 75b72cb4f9 Auso support -h hash for hard-linked files. 2004-01-30 01:38:25 +00:00
wiz f46a4026cc Drop trailing space. 2004-01-29 11:17:37 +00:00
lukem 37cb4fb1d9 Implement -h {none,md5,rmd160,sha1} to determine the appropriate hash
(digest) when copying a file to store in the -M METALOG.
2004-01-29 07:58:33 +00:00
lukem 5541148775 now that -c is the default, use "copy" instead of "move" 2004-01-27 02:49:42 +00:00
simonb 60e35b79cc Make "copy the file" (the -c option) the default behaviour. The -c option
is kept for backwards compatibility but now has no effect.

Patch from Bruce Nourish in PR bin/23874, with some minor changes by me.
2003-12-29 02:01:27 +00:00
heas 16e5c22815 Initialize uid and gid so that the owner/group is not inadvertantly changed
when only one of -g or -o are given by the super-user and -g works for others.
2003-12-16 20:51:57 +00:00
christos dd092f8c34 munmap() so that we don't accumulate memory on multiple files. 2003-11-21 21:20:25 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
itojun ae4b4e6dbb strlcat 2003-07-12 14:30:53 +00:00
jmmv 5fa5de38b4 Use ; instead of , in a sentence (and fix case of next word). 2003-05-24 18:24:28 +00:00
lukem 826a14607a Now that <bsd.prog.mk> DTRT if HOSTPROG is defined (i.e, it is a no-op),
there's no need to special-case .include-ing it.
2003-05-18 07:57:31 +00:00
thorpej 213cc4baf9 Don't do the madvise(2) call if __APPLE__. Even though madvise(2)
exists on Mac OS X, and we pass valid arguments, the call always
results in EINVAL, and the warning annoys me.
2003-03-13 18:23:02 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
wiz 0065eb62cf Add a missing word. 2002-12-23 12:49:38 +00:00
lukem 08fab22988 DTRT with -D destdir when the target == destdir 2002-12-23 06:24:15 +00:00
lukem f766ef620d Implement '-D destdir'; if '-M metalog' is being used, remove a
leading `destdir' from the file name logged to the metalog.
The -D option has no effect on where the actual files are installed.
2002-12-22 10:15:17 +00:00
wiz 57f65f0dda Drop trailing whitespace. 2002-12-19 09:17:01 +00:00
lukem c7c281222a Add '-N dbdir', to specify that user & group lookups are to be done from
dbdir/master.passwd and dbdir/group, using simple text file parsing
routines from ../../usr.sbin/mtree/getid.c.
2002-12-19 08:30:39 +00:00
grant be8ae688ae New sentence, new line. 2002-09-30 11:08:56 +00:00
lukem 5d4973fe97 makefile delint. use NETBSDSRCDIR as appropriate 2002-09-18 14:00:33 +00:00
lukem 9d35c8059d Convert from flock() to the more portable fcntl().
As discussed with Mason Loring Bliss <mason@netbsd.org>
2002-06-09 04:16:39 +00:00
yamt 9ef78f3840 make an auto const variable static. 2002-06-08 15:02:27 +00:00
lukem d656686b8f doh. don't try and update from_sb and tv if dolink is set 2002-04-10 06:12:04 +00:00
lukem c1961c25e2 always stat into &from_sb and setup tv[]; stops weird problem noticed
by Simon Burge when installing from /dev/null resulted in weird dates.
2002-04-10 06:02:52 +00:00
lukem 3d000fd59c - Add "-a afterinstallcommand", which runs "sh -c afterinstallcmd target"
after target has been installed and possibly stripped with -s, but
  before ownership, permissions or timestamps are set, and before
  renaming (with -r) occurs.  Per discussion with simonb.
- When metalogging hardlinks, log the mode of the existing target
  (rather than the default 0755), and ignore owner/group/fflags.
- Improve man page description of various options to include argument name.
- Clean up usage() to use getprogname(), etc.
2002-03-19 14:17:04 +00:00
lukem 0d4517aa6c When metalogging a hard link, don't log it as "type=hlink".
Instead, stat the type, and only log an entry if it's a "type=file".
We could log hard links to symlinks, but they're not portable and
their use has been deprecated in our source tree.
Hard links to other types aren't as useful at this stage; if the need
arises we can change this to log the appropriate information then.
2002-02-28 00:22:51 +00:00
ross 2a76afae02 Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:36:18 +00:00
tv 9fbd88883c Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
  sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
2002-01-31 22:43:33 +00:00
tv b212f6ddf9 Identify where errors come from, rather than just doing err[x]("%s", foo). 2002-01-28 19:44:03 +00:00
tv 8f2707ae00 Add non-NetBSD host hooks. 2002-01-21 20:00:02 +00:00
msaitoh 4a4b629051 ADD MISSING SLASH.
Broken insall had been made a temporary file at the parent directory
(may cause Cross-device link(EXDEV)).
2001-12-10 08:54:38 +00:00