Commit Graph

121 Commits

Author SHA1 Message Date
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
wiz 305734fe40 Punctuation nit. 2001-12-08 19:27:33 +00:00
wiz aded0d2cce Whitespace cleanup. 2001-12-01 16:43:07 +00:00
perry 37799562b4 fix an accidental use of dirname instead of xdirname 2001-11-24 21:58:42 +00:00
perry a772ed1f5f add comments noting the mktemp usage is safe.
long run I think we have to abandon using the linker for warnings and
beef up lint instead.
2001-11-23 18:14:51 +00:00
simonb 6c70c79401 Overhaul link creation - splitting out hard and symbolic link handling
to separate functions and handling -r (renaming) correctly for both
cases.
Also fix most lint(1) warnings.
2001-11-23 16:14:51 +00:00
dillo d1be3cca41 Make metadata logging of set-id bits work for unprived installs.
These bits were cleared from mode before a call to fchmod and later
that changed value was logged.
2001-11-22 23:27:38 +00:00
perry 75824c636a simplify metadata logging, and add metadata logging for hard links. 2001-11-19 02:51:00 +00:00
tv aff1bdffff Actually do a chmod if -U, but only try chmod'ing the lower 0777 bits.
This is needed to make things executable, where appropriate.
2001-11-12 19:08:31 +00:00
lukem 01381cc6c0 change metadata_log() to support logging symlink info as well
(including target name).  pointed out by perry.
2001-10-29 02:57:21 +00:00
perry 0f1e6ffaee Do not attempt to stat the source if we are dealing with a link. We
aren't going to do anything with the information anyway and there is
error checking later anyway.
We can now succeed in creating symlinks to locations that don't exist,
just as ln -s will let us do, and we can use install instead of ln -s
in several Makefiles. The code was written with the obvious intent to
let you do this but apparently it was never tested.
2001-10-29 00:25:44 +00:00
perry 1ceecb558f 1) Remove a comment that bore no resemblance to reality. It was worse
than having no comment at all by far.
2) fix an instance in which we checked if "from" wasn't a regular file
   and then bitched about "to".
2001-10-28 23:43:19 +00:00
lukem 99b386d4f8 Add '-T tags', to specify mtree(8) tags to be written out to the '-M metalog'
for the current entry.  Concept suggested by Perry Metzger.
2001-10-25 15:37:06 +00:00
lukem be0d379732 minor knf 2001-10-25 15:06:12 +00:00
tv 88917ec7e1 If unprivileged, we may be running on a system that doesn't have the proper
/etc/passwd and /etc/group (as well as concept of file flags) as the target.

Rather than look up users, groups, or flags with -U, do what the manpage
indicates:  don't even try changing them.  If -M is specified, use the
strings that are passed in via options with "gname", "uname", and "flags"
in the resultant mtree file, rather than retranslating them back from numbers.
2001-10-19 14:26:19 +00:00
lukem c3e7e8005a oops, got chflags() error checking around the wrong way 2001-10-11 04:27:30 +00:00
lukem c32ec6cb78 - Implement "-M log", which appends the metadata associated with the
installed file or directory to `log'. This is primarily designed
  to be used in conjunction with -U, but that's not mandatory.
  Provide metadata_log() to do the hard work. The log file is opened
  for append at the start, and flock(LOCK_EX) is used to prevent
  interleaved output (from multiple concurrent install(8) operations).
- Improve parsing of owner and groups (e.g., strtoul() instead of atoi()),
  and don't rely upon uid==-1 to indicate "no owner"; use a flag instead.
- Make fileflags a global variable; uid, gid, and mode are, so lets be
  consistent...
- Improve -U (unpriv); work on file flags as well, and only try to change
  the file flags after the temporary file is renamed (since certain flags
  will prevent the rename from working).
2001-10-11 02:06:32 +00:00
simonb 1730261818 Throw out home-grown strdup().
Error check malloc/strdup return values.
2001-09-15 16:45:23 +00:00