1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-14 14:55:41 +00:00

Add a -D flag that causes duplicate entries in an mtree manifest to be

treated as warnings rather than errors.

Reviewed by:	marcel
Sponsored by:	DARPA, AFRL
This commit is contained in:
Brooks Davis 2013-02-20 15:18:42 +00:00
parent 297c1ec124
commit b0d9adde80
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=247041
4 changed files with 18 additions and 4 deletions

View File

@ -43,7 +43,7 @@
.Nd create a file system image from a directory tree or a mtree manifest
.Sh SYNOPSIS
.Nm
.Op Fl px
.Op Fl Dpx
.Op Fl B Ar byte-order
.Op Fl b Ar free-blocks
.Op Fl d Ar debug-mask
@ -106,6 +106,8 @@ An optional
suffix may be provided to indicate that
.Ar free-blocks
indicates a percentage of the calculated image size.
.It Fl D
Treat duplicate paths in an mtree manifest as warnings not error.
.It Fl d Ar debug-mask
Enable various levels of debugging, depending upon which bits are
set in

View File

@ -73,6 +73,7 @@ static fstype_t fstypes[] = {
};
u_int debug;
int dupsok;
struct timespec start_time;
static fstype_t *get_fstype(const char *);
@ -112,7 +113,7 @@ main(int argc, char *argv[])
start_time.tv_sec = start.tv_sec;
start_time.tv_nsec = start.tv_usec * 1000;
while ((ch = getopt(argc, argv, "B:b:d:f:F:M:m:N:o:ps:S:t:x")) != -1) {
while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:ps:S:t:x")) != -1) {
switch (ch) {
case 'B':
@ -148,6 +149,10 @@ main(int argc, char *argv[])
}
break;
case 'D':
dupsok = 1;
break;
case 'd':
debug = strtoll(optarg, NULL, 0);
break;

View File

@ -169,6 +169,7 @@ void cd9660_makefs(const char *, const char *, fsnode *, fsinfo_t *);
extern u_int debug;
extern int dupsok;
extern struct timespec start_time;
/*

View File

@ -881,8 +881,14 @@ read_mtree_spec1(FILE *fp, bool def, const char *name)
if (strcmp(name, node->name) == 0) {
if (def == true) {
mtree_error("duplicate definition of %s",
name);
if (!dupsok)
mtree_error(
"duplicate definition of %s",
name);
else
mtree_warning(
"duplicate definition of %s",
name);
return (0);
}