Commit Graph

80 Commits

Author SHA1 Message Date
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
simonb
0b2413bddc ANSIfy. 2001-09-15 14:55:38 +00:00
wiz
251b3464be heirarchy -> hierarchy 2001-08-24 10:24:45 +00:00
tv
dba5d44670 Add hooks to allow toolchain bits to be reachover-built at the top level. 2001-08-14 10:18:26 +00:00
kleink
361f8ca975 Add the -r flag to usage output. 2001-06-15 08:25:11 +00:00
kleink
d2fd431b8f The -r flag is applicable to the file1 -> file2 case, too. 2001-06-15 08:24:17 +00:00
chs
1055c758b8 fall back to read() if mmap() returns an error. 2001-05-28 03:37:22 +00:00
cgd
ab2465366a slight portability improvement: use madvise(... MADV_SEQUENTIAL ...)
iff MADV_SEQUENTIAL is actually defined.
2001-03-21 23:16:33 +00:00
cgd
040de26f85 call setprogname(argv[0]) at start of main() 2001-02-21 00:06:22 +00:00
jlam
d6ced75307 Change
"program used to trip installed binaries"
to
	"program used to strip installed binaries"
2000-12-27 18:56:21 +00:00
enami
e92c3f2867 - The type of return value of setmode is a void * and getmode takes it,
rather than mode_t *.
- Free the storage allocated by setmode unless it is obvious that program
  exits immediately.
2000-10-10 14:30:40 +00:00
kleink
4918722a89 For commands and utilities, use EXIT STATUS rather than RETURN VALUES or
DIAGNOSTICS as appropriate (and documented in mdoc(7)).
2000-09-04 07:35:15 +00:00
hubertf
d374d97e3c Allow overriding _PATH_STRIP 2000-09-04 02:45:33 +00:00
cgd
08f606dddb If unprivileged, don't even look up user or group name. (always set uid and
gid to -1.)  Don't bother checking 'unpriv' when it's redundant with the
uid/gid == -1 check.  (Doing the uid/gid handling consistently also fixes
the directory-creation code, which didn't check unpriv and did chmod/chown
anyway.)  One minor spaces/tabs cleanup at one of the uid/gid checks.
2000-07-27 03:57:50 +00:00
cgd
72b221b09c clean up documentation of STRIP envioronment var. 2000-07-27 03:48:08 +00:00
cgd
3ae828ab49 invoke stripprog using execlp. (this mirrors the behaviour that would
be had from using the shell to invoke strip, and removes an unnecessary
limitation that the STRIP environment variable be an absolute path.)
2000-07-27 03:45:02 +00:00
garbled
36f447259d Make the STRIP env var a little more obvious in the documentation, and
clean up the bottom of this manpage just a tad.
2000-03-22 18:34:43 +00:00
christos
b41faac27c don't bitch if madvise returns EOPNOTSUPP 2000-01-15 01:10:12 +00:00
simonb
299578ebd5 Spell "privilege" correctly (correct spelling from Jonathan Stone). 1999-08-16 02:59:22 +00:00
sommerfeld
0c41be440f Add `-U' flag (for "unprivileged"). Currently just skips the
chown/chgrp stages which would otherwise blow out if not running as
root.  A future version may log the owner/group to allow correction by
a later privileged cleanup pass.

Just warn about madvise failure; it's not something to blow up about.

Document new option, and clean up option grouping for -d (install
directory) option.
1999-08-01 05:02:06 +00:00
christos
4bcc4c73c4 pacify gcc-2.8 uninitialized variable warnings, and only use timespecs in
struct stat on BSD4_4 systems.
1999-07-06 14:45:31 +00:00
thorpej
61296f9b4d If we choose the mmap() method of copying the file, advise the VM
system that we'll be doing sequential access of the file.
1999-06-26 00:41:39 +00:00
hubertf
558dea2645 Check if given suffix really generates different suffixes - catch e.g. ".%"
Submitted in PR 7278 by NAKAJIMA Yoshihiro <nakayosh@kcn.ne.jp>
1999-03-29 17:01:49 +00:00
christos
a33a2c20ff Don't unlink the file first if we are renaming. We want to be as atomic as
possible, and this not only introduces time where the file is not valid,
but also breaks in the ld.so install where strip does not find ld.so, since
it has not been renamed yet.
1999-03-24 15:13:46 +00:00
garbled
9e44e9b578 More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:16:34 +00:00
mycroft
a1c657fe56 Clean up SYNOPSIS formatting. 1999-03-07 11:29:58 +00:00
christos
c888dfac35 PR/2936: Brian C. Grayson: Avoid truncating precious files when installing
and the filesystem is full. Added -r flag to install, which installs on
a temporary file and then renames to the final destination.
1999-02-04 11:56:48 +00:00
hubertf
5f648bdae3 enable numbered backups via -B.old%02d 1999-01-26 01:34:25 +00:00
hubertf
a9539cd876 Add a -b(ackup) flag to move any existing file(s) aside by renaming
them to file.old instead of simply deleting them. A different backup
suffix may be chosen with the -B option's argument.
1999-01-25 01:42:57 +00:00
christos
2f6a33d29c char -> unsigned char 1998-12-20 15:07:46 +00:00
mrg
14a817a516 create a "stat_flags.h" to go with stat_flags.c 1998-10-10 07:38:22 +00:00
wsanchez
438823cc1c Add new option -S, which is like -s, but takes a string of options to pass to strip,
rather than "-s". For example:
	install -S "-i -s symbolfile" foo /usr/bin/foo
  Invokes:
	/bin/sh -c "strip -i -s /usr/bin/foo"
  This is needed, because we need different strip options for dynamic libraries and
  Mach-O bundles than for executables; our strip supports more directed stripping.
  /bin/sh is used in this case, to parse the arguments.

Don't bother mmap()ing files of zero length. Was a workaround for a bug in our mmap(),
  which didn't get along with such files, but makes sense anyway.
1998-10-08 02:12:51 +00:00
erh
ecf84c1f19 Add -p flag to usage(). 1998-10-01 18:23:52 +00:00
christos
710d4c153b add -p flag, similar to cp(1) 1998-09-28 08:16:15 +00:00
mycroft
4462053ab3 Fill in missing (default) mmap(2) flags. 1998-02-20 09:27:18 +00:00
thorpej
e00e57ff80 Delete extra RCS ID. 1997-12-30 22:31:17 +00:00
chuck
6bfc234bf3 use MAP_PRIVATE for mmap flags, not the non-standard MAP_FILE (aka 0) 1997-12-01 21:11:39 +00:00
tv
070c43b239 accept -c silently with -d; fixes GNU autoconf (among others) that assume
you can use -c with -d
...but this is NOT a reason for those of you making install procedures
to think this behaviour is `correct'... <grin>
1997-11-30 22:20:00 +00:00
thorpej
e3a9b9d0ca In strip():
- Use the saved errno to print the error message if the vfork() fails.
- In the child, if the execl() fails, use warn()/_exit(), not err(),
  as the latter is not safe in the presence of a Real vfork().
1997-10-27 23:16:34 +00:00
lukem
42feae592b getopt returns -1 not EOF, fix .Nm 1997-10-20 03:32:25 +00:00
mrg
6e4783d48e WARNSify; deprecate register; clean up .Nm 1997-10-19 14:42:36 +00:00
gwr
10e180cc49 Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.
1997-05-08 21:11:01 +00:00