tree-wide: hook up image dissection policy logic everywhere
This commit is contained in:
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user