summaryrefslogtreecommitdiffstats
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2013-02-20 15:18:42 +0000
committerbrooks <brooks@FreeBSD.org>2013-02-20 15:18:42 +0000
commitdabbf96e6dc93cae3d712c967b8297077e85c14c (patch)
treeed5d5cf77512085eba9acb0eb702d6efa2b649fa /usr.sbin/makefs
parentc00d15a4dde2c54b90438648342d1c185b81b1c3 (diff)
downloadFreeBSD-src-dabbf96e6dc93cae3d712c967b8297077e85c14c.zip
FreeBSD-src-dabbf96e6dc93cae3d712c967b8297077e85c14c.tar.gz
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
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/makefs.84
-rw-r--r--usr.sbin/makefs/makefs.c7
-rw-r--r--usr.sbin/makefs/makefs.h1
-rw-r--r--usr.sbin/makefs/mtree.c10
4 files changed, 18 insertions, 4 deletions
diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8
index b1a5751..81bf334 100644
--- a/usr.sbin/makefs/makefs.8
+++ b/usr.sbin/makefs/makefs.8
@@ -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
diff --git a/usr.sbin/makefs/makefs.c b/usr.sbin/makefs/makefs.c
index b2da82b..03ff1ac 100644
--- a/usr.sbin/makefs/makefs.c
+++ b/usr.sbin/makefs/makefs.c
@@ -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;
diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h
index 483ccff..6146376 100644
--- a/usr.sbin/makefs/makefs.h
+++ b/usr.sbin/makefs/makefs.h
@@ -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;
/*
diff --git a/usr.sbin/makefs/mtree.c b/usr.sbin/makefs/mtree.c
index 836e766..f5eb5fc 100644
--- a/usr.sbin/makefs/mtree.c
+++ b/usr.sbin/makefs/mtree.c
@@ -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);
}
OpenPOWER on IntegriCloud