diff options
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl.c | 21 | ||||
-rw-r--r-- | src/systemctl/systemctl.h | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 1a5beabc72..df4cf68435 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -121,6 +121,7 @@ bool arg_read_only = false; bool arg_mkdir = false; bool arg_marked = false; const char *arg_drop_in = NULL; +ImagePolicy *arg_image_policy = NULL; STATIC_DESTRUCTOR_REGISTER(arg_types, strv_freep); STATIC_DESTRUCTOR_REGISTER(arg_states, strv_freep); @@ -135,6 +136,7 @@ STATIC_DESTRUCTOR_REGISTER(arg_host, unsetp); STATIC_DESTRUCTOR_REGISTER(arg_boot_loader_entry, unsetp); STATIC_DESTRUCTOR_REGISTER(arg_clean_what, strv_freep); STATIC_DESTRUCTOR_REGISTER(arg_drop_in, unsetp); +STATIC_DESTRUCTOR_REGISTER(arg_image_policy, image_policy_freep); static int systemctl_help(void) { _cleanup_free_ char *link = NULL; @@ -305,7 +307,9 @@ static int systemctl_help(void) { " --root=PATH Edit/enable/disable/mask unit files in the specified\n" " root directory\n" " --image=PATH Edit/enable/disable/mask unit files in the specified\n" - " image\n" + " disk image\n" + " --image-policy=POLICY\n" + " Specify disk image dissection policy\n" " -n --lines=INTEGER Number of journal entries to show\n" " -o --output=STRING Change journal output mode (short, short-precise,\n" " short-iso, short-iso-precise, short-full,\n" @@ -450,6 +454,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { ARG_NO_WARN, ARG_DROP_IN, ARG_WHEN, + ARG_IMAGE_POLICY, }; static const struct option options[] = { @@ -515,6 +520,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) { { "marked", no_argument, NULL, ARG_MARKED }, { "drop-in", required_argument, NULL, ARG_DROP_IN }, { "when", required_argument, NULL, ARG_WHEN }, + { "image-policy", required_argument, NULL, ARG_IMAGE_POLICY }, {} }; @@ -1003,6 +1009,18 @@ static int systemctl_parse_argv(int argc, char *argv[]) { break; + case ARG_IMAGE_POLICY: { + _cleanup_(image_policy_freep) ImagePolicy *p = NULL; + + r = image_policy_from_string(optarg, &p); + if (r < 0) + return log_error_errno(r, "Failed to parse image policy: %s", optarg); + + image_policy_free(arg_image_policy); + arg_image_policy = TAKE_PTR(p); + break; + } + case '.': /* Output an error mimicking getopt, and print a hint afterwards */ log_error("%s: invalid option -- '.'", program_invocation_name); @@ -1248,6 +1266,7 @@ static int run(int argc, char *argv[]) { r = mount_image_privately_interactively( arg_image, + arg_image_policy, DISSECT_IMAGE_GENERIC_ROOT | DISSECT_IMAGE_REQUIRE_ROOT | DISSECT_IMAGE_RELAX_VAR_CHECK | diff --git a/src/systemctl/systemctl.h b/src/systemctl/systemctl.h index 8c96ee0b4f..03645624ee 100644 --- a/src/systemctl/systemctl.h +++ b/src/systemctl/systemctl.h @@ -5,6 +5,7 @@ #include "bus-print-properties.h" #include "bus-util.h" +#include "image-policy.h" #include "install.h" #include "output-mode.h" #include "pager.h" @@ -100,6 +101,7 @@ extern bool arg_read_only; extern bool arg_mkdir; extern bool arg_marked; extern const char *arg_drop_in; +extern ImagePolicy *arg_image_policy; static inline const char* arg_job_mode(void) { return _arg_job_mode ?: "replace"; |