Commit Graph

64 Commits

Author SHA1 Message Date
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
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
simonb 0b2413bddc ANSIfy. 2001-09-15 14:55:38 +00:00
wiz 251b3464be heirarchy -> hierarchy 2001-08-24 10:24:45 +00:00
kleink 361f8ca975 Add the -r flag to usage output. 2001-06-15 08:25:11 +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
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
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 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
christos b41faac27c don't bitch if madvise returns EOPNOTSUPP 2000-01-15 01:10:12 +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
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
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
mikel e66130db20 use proper pathname when unable to exec strip 1997-04-19 03:50:29 +00:00
thorpej 00b4f27f35 Allow the environment variable $STRIP to override _PATH_STRIP for
`-s', helping out cross-compiling.
1997-04-17 07:56:55 +00:00
christos 852505afb6 Fix pasto in error message. 1997-03-16 19:46:02 +00:00
christos 9384236fae Add support for installing hard and symbolic links via the [-l harms] flag. 1997-03-16 19:43:19 +00:00
mycroft 2c450c6cc2 Remove kluge for GCC bug on m68k. 1997-03-12 18:13:17 +00:00