Page MenuHomeFreeBSD

D19963.id56381.diff
No OneTemporary

D19963.id56381.diff

Index: sbin/mdmfs/mdmfs.8
===================================================================
--- sbin/mdmfs/mdmfs.8
+++ sbin/mdmfs/mdmfs.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 9, 2017
+.Dd April 19, 2019
.Dt MDMFS 8
.Os
.Sh NAME
@@ -48,6 +48,7 @@
.Op Fl F Ar file
.Op Fl f Ar frag-size
.Op Fl i Ar bytes
+.Op Fl k Ar skel
.Op Fl m Ar percent-free
.Op Fl O Ar optimization
.Op Fl o Ar mount-options
@@ -193,6 +194,11 @@
The fragment size of the file system in bytes.
.It Fl i Ar bytes
Number of bytes per inode.
+.It Fl k Ar skel
+Copy the content of directory
+.Ar skel
+into
+.Ar mount-point .
.It Fl l
Enable multilabel MAC on the new file system.
.It Fl L
Index: sbin/mdmfs/mdmfs.c
===================================================================
--- sbin/mdmfs/mdmfs.c
+++ sbin/mdmfs/mdmfs.c
@@ -88,6 +88,7 @@
static void do_mount_tmpfs(const char *, const char *);
static void do_mtptsetup(const char *, struct mtpt_info *);
static void do_newfs(const char *);
+static void do_copy(const char *, const char *);
static void extract_ugid(const char *, struct mtpt_info *);
static int run(int *, const char *, ...) __printflike(2, 3);
static const char *run_exitstr(int);
@@ -104,7 +105,7 @@
enum md_types mdtype; /* The type of our memory disk. */
bool have_mdtype, mlmac;
bool detach, softdep, autounit, newfs;
- const char *mtpoint, *size_arg, *unitstr;
+ const char *mtpoint, *size_arg, *skel, *unitstr;
char *p;
int ch, idx;
void *set;
@@ -118,6 +119,7 @@
mlmac = false;
newfs = true;
have_mdtype = false;
+ skel = NULL;
mdtype = MD_SWAP;
mdname = MD_NAME;
mdnamelen = strlen(mdname);
@@ -142,7 +144,7 @@
}
while ((ch = getopt(argc, argv,
- "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1)
+ "a:b:Cc:Dd:E:e:F:f:hi:k:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1)
switch (ch) {
case 'a':
argappend(&newfs_arg, "-a %s", optarg);
@@ -184,6 +186,9 @@
case 'i':
argappend(&newfs_arg, "-i %s", optarg);
break;
+ case 'k':
+ skel = optarg;
+ break;
case 'L':
loudsubs = true;
break;
@@ -359,6 +364,8 @@
}
do_mtptsetup(mtpoint, &mi);
+ if (skel != NULL)
+ do_copy(mtpoint, skel);
return (0);
}
@@ -615,6 +622,23 @@
run_exitnumber(rv));
}
+
+/*
+ * Copy skel into the mountpoint.
+ */
+static void
+do_copy(const char *mtpoint, const char *skel)
+{
+ int rv;
+
+ rv = chdir(skel);
+ if (rv != 0)
+ err(1, "chdir to %s", skel);
+ rv = run(NULL, "/bin/pax -rw -pe . %s", mtpoint);
+ if (rv != 0)
+ errx(1, "skel copy failed");
+}
+
/*
* 'str' should be a user and group name similar to the last argument
* to chown(1); i.e., a user, followed by a colon, followed by a
@@ -822,8 +846,8 @@
fprintf(stderr,
"usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n"
"\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n"
-"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n"
-"\t[-O optimization] [-o mount-options]\n"
+"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-k skel]\n"
+"\t[-m percent-free] [-O optimization] [-o mount-options]\n"
"\t[-p permissions] [-s size] [-v version] [-w user:group]\n"
"\tmd-device mount-point\n", getprogname());
exit(1);

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 20, 2:38 PM (7 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31846035
Default Alt Text
D19963.id56381.diff (3 KB)

Event Timeline