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.
This commit is contained in:
lukem 2001-10-25 15:37:06 +00:00
parent be0d379732
commit 99b386d4f8
2 changed files with 48 additions and 22 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: install.1,v 1.25 2001/10/11 02:06:32 lukem Exp $
.\" $NetBSD: install.1,v 1.26 2001/10/25 15:37:06 lukem Exp $
.\"
.\" Copyright (c) 1987, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,7 +33,7 @@
.\"
.\" @(#)install.1 8.1 (Berkeley) 6/6/93
.\"
.Dd October 11, 2001
.Dd October 26, 2001
.Dt INSTALL 1
.Os
.Sh NAME
@ -49,7 +49,10 @@
.Op Fl f Ar flags
.Ek
.Bk -words
.Op Fl M Ar log
.Op Fl M Ar metalog
.Ek
.Bk -words
.Op Fl T Ar tags
.Ek
.Bk -words
.Op Fl m Ar mode
@ -76,7 +79,10 @@
.Op Fl f Ar flags
.Ek
.Bk -words
.Op Fl M Ar log
.Op Fl M Ar metalog
.Ek
.Bk -words
.Op Fl T Ar tags
.Ek
.Bk -words
.Op Fl m Ar mode
@ -99,7 +105,10 @@
.Op Fl Up
.Fl d
.Bk -words
.Op Fl M Ar log
.Op Fl M Ar metalog
.Ek
.Bk -words
.Op Fl T Ar tags
.Ek
.Bk -words
.Op Fl m Ar mode
@ -165,15 +174,15 @@ Specify the target's file flags.
for a list of possible flags and their meanings.)
.It Fl g
Specify a group.
.It Fl M Ar log
.It Fl M Ar metalog
Write the metadata associated with each item installed to
.Ar log
.Ar metalog
in an
.Xr mtree 8
.Dq full path
compatible format.
specification line.
The metadata includes: the file name and file type, and depending upon
other options, the owner, group, file flags, and modification time.
other options, the owner, group, file flags, modification time, and tags.
.It Fl m
Specify an alternative mode.
The default mode is set to rwxr-xr-x (0755).
@ -222,17 +231,27 @@ passes
.Ar stripflags
as option arguments to
.Xr strip 1 .
When -S is used,
When
.Fl S
is used,
.Xr strip 1
is invoked via the
.Xr sh 1
shell, allowing a single -S argument be to specified to
shell, allowing a single
Fl S
argument be to specified to
.Nm
which the shell can then tokenize. Normally,
.Nm
invokes
.Xr strip 1
directly. This flag implies -s.
directly. This flag implies
.Fl s .
.It Fl T Ar tags
Specify the
.Xr mtree 8
tags to write out for the file when using
.Fl M Ar metalog .
.It Fl d
Create directories.
Missing parent directories are created as required.
@ -241,7 +260,7 @@ Indicate that install is running unprivileged, and that it should not
try to change the owner, the group, or the file flags of the destination.
The information that would have been updated can be stored in a log
file with
.Fl M Ar log.
.Fl M Ar metalog.
.El
.Pp
By default,
@ -276,7 +295,8 @@ is used.
.Xr cp 1 ,
.Xr mv 1 ,
.Xr strip 1 ,
.Xr chown 8
.Xr chown 8 ,
.Xr mtree 8
.Sh HISTORY
The
.Nm

View File

@ -1,4 +1,4 @@
/* $NetBSD: xinstall.c,v 1.53 2001/10/25 15:06:12 lukem Exp $ */
/* $NetBSD: xinstall.c,v 1.54 2001/10/25 15:37:06 lukem Exp $ */
/*
* Copyright (c) 1987, 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
#if 0
static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#else
__RCSID("$NetBSD: xinstall.c,v 1.53 2001/10/25 15:06:12 lukem Exp $");
__RCSID("$NetBSD: xinstall.c,v 1.54 2001/10/25 15:37:06 lukem Exp $");
#endif
#endif /* not lint */
@ -78,7 +78,7 @@ int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
char pathbuf[MAXPATHLEN];
uid_t uid;
gid_t gid;
char *group, *owner, *fflags;
char *group, *owner, *fflags, *tags;
FILE *metafp;
char *metafile;
u_long fileflags;
@ -119,7 +119,7 @@ main(int argc, char *argv[])
setprogname(argv[0]);
iflags = 0;
while ((ch = getopt(argc, argv, "cbB:df:g:l:m:M:o:prsS:U")) != -1)
while ((ch = getopt(argc, argv, "cbB:df:g:l:m:M:o:prsS:T:U")) != -1)
switch((char)ch) {
case 'B':
suffix = optarg;
@ -207,6 +207,9 @@ main(int argc, char *argv[])
case 's':
dostrip = 1;
break;
case 'T':
tags = optarg;
break;
case 'U':
dounpriv = 1;
break;
@ -747,6 +750,8 @@ metadata_log(const char *path, mode_t type, u_int flags, struct timeval *tv)
fprintf(metafp, " gname=%s", group);
if (fflags)
fprintf(metafp, " flags=%s", fflags);
if (tags)
fprintf(metafp, " tags=%s", tags);
if (tv != NULL)
fprintf(metafp, " time=%ld.%ld", tv[1].tv_sec, tv[1].tv_usec);
fputc('\n', metafp);
@ -768,11 +773,12 @@ usage(void)
{
(void)fprintf(stderr, "\
usage: install [-Ubcprs] [-M log] [-B suffix] [-f flags] [-m mode]\n\
usage: install [-Ubcprs] [-M log] [-T tags] [-B suffix] [-f flags] [-m mode]\n\
[-o owner] [-g group] [-l linkflags] [-S stripflags] file1 file2\n\
install [-Ubcprs] [-M log] [-B suffix] [-f flags] [-m mode]\n\
[-o owner] [-g group] [-l linkflags] [-S stripflags] \n\
install [-Ubcprs] [-M log] [-T tags] [-B suffix] [-f flags] [-m mode]\n\
[-o owner] [-g group] [-l linkflags] [-S stripflags]\n\
file1 ... fileN directory\n\
install [-Up] [-M log] -d [-m mode] [-o owner] [-g group] directory ...\n");
install [-Up] [-M log] [-T tags] -d [-m mode]\n\
[-o owner] [-g group] directory ...\n");
exit(1);
}