aboutsummaryrefslogtreecommitdiff
path: root/sbin/bectl/bectl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/bectl/bectl.c')
-rw-r--r--sbin/bectl/bectl.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sbin/bectl/bectl.c b/sbin/bectl/bectl.c
index 28483dae17b2..7f462984267f 100644
--- a/sbin/bectl/bectl.c
+++ b/sbin/bectl/bectl.c
@@ -53,6 +53,7 @@ usage(bool explicit)
"\tbectl [-r beroot] check\n"
"\tbectl [-r beroot] create [-r] [-e {nonActiveBe | beName@snapshot}] beName\n"
"\tbectl [-r beroot] create [-r] beName@snapshot\n"
+ "\tbectl [-r beroot] create -E beName\n"
"\tbectl [-r beroot] destroy [-Fo] {beName | beName@snapshot}\n"
"\tbectl [-r beroot] export sourceBe\n"
"\tbectl [-r beroot] import targetBe\n"
@@ -184,15 +185,19 @@ bectl_cmd_create(int argc, char *argv[])
char snapshot[BE_MAXPATHLEN];
char *atpos, *bootenv, *snapname;
int err, opt;
- bool recursive;
+ bool empty, recursive;
snapname = NULL;
+ empty = false;
recursive = false;
- while ((opt = getopt(argc, argv, "e:r")) != -1) {
+ while ((opt = getopt(argc, argv, "e:Er")) != -1) {
switch (opt) {
case 'e':
snapname = optarg;
break;
+ case 'E':
+ empty = true;
+ break;
case 'r':
recursive = true;
break;
@@ -221,6 +226,13 @@ bectl_cmd_create(int argc, char *argv[])
*/
*atpos++ = '\0';
err = be_snapshot(be, bootenv, atpos, recursive, NULL);
+ } else if (empty) {
+ if (snapname || recursive) {
+ fprintf(stderr,
+ "bectl create: -E cannot be combined with -e or -r\n");
+ return (usage(false));
+ }
+ err = be_create_empty(be, bootenv);
} else {
if (snapname == NULL)
/* Create from currently booted BE */