Add a simple -v (verbose) option that allows you to see when -C actually

installs something.  This is not 100% right, since it has a false hit
when install -C snaps hard links.

Also, run strip(1) from the $PATH, otherwise you need a special version
of install to install (say) elf binaries which have a different strip.
With JDP's elfkit, the layout of the path determines which binary format
you are generating.
This commit is contained in:
Peter Wemm 1996-08-12 17:03:30 +00:00
parent c9e1a96c5a
commit c00062b834
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17546

View File

@ -40,7 +40,7 @@ static const char copyright[] =
#ifndef lint
/*static char sccsid[] = "From: @(#)xinstall.c 8.1 (Berkeley) 7/21/93";*/
static const char rcsid[] =
"$Id: xinstall.c,v 1.7 1996/04/08 10:59:36 joerg Exp $";
"$Id: xinstall.c,v 1.8 1996/06/23 12:59:18 bde Exp $";
#endif /* not lint */
/*-
@ -79,7 +79,7 @@ static const char rcsid[] =
#include "pathnames.h"
int debug, docompare, docopy, dopreserve, dostrip;
int debug, docompare, docopy, dopreserve, dostrip, verbose;
int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
char *group, *owner, pathbuf[MAXPATHLEN];
char pathbuf2[MAXPATHLEN];
@ -126,7 +126,7 @@ main(argc, argv)
char *flags, *to_name;
iflags = 0;
while ((ch = getopt(argc, argv, "Ccdf:g:m:o:ps")) != EOF)
while ((ch = getopt(argc, argv, "Ccdf:g:m:o:psv")) != EOF)
switch((char)ch) {
case 'C':
docompare = docopy = 1;
@ -161,6 +161,9 @@ main(argc, argv)
case 's':
dostrip = 1;
break;
case 'v':
verbose = 1;
break;
case '?':
default:
usage();
@ -394,6 +397,10 @@ install(from_name, to_name, fset, flags)
(void)utime(to_name, &utb);
}
moveit:
if (verbose) {
printf("install: %s -> %s\n",
from_name, old_to_name);
}
if (rename(to_name, old_to_name) < 0) {
serrno = errno;
unlink(to_name);
@ -557,8 +564,8 @@ strip(to_name)
errno = serrno;
err(EX_TEMPFAIL, "fork");
case 0:
execl(_PATH_STRIP, "strip", to_name, NULL);
err(EX_OSERR, "exec(" _PATH_STRIP ")");
execlp("strip", "strip", to_name, NULL);
err(EX_OSERR, "exec(strip)");
default:
if (wait(&status) == -1 || status) {
(void)unlink(to_name);