static char *arg_generate_fstab = NULL;
static char *arg_generate_crypttab = NULL;
static Set *arg_verity_settings = NULL;
+static bool arg_relax_copy_block_security = false;
STATIC_DESTRUCTOR_REGISTER(arg_node, freep);
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
r = parse_path_argument(optarg, /* suppress_root= */ false, &arg_image);
if (r < 0)
return r;
+
+ arg_relax_copy_block_security = false;
+
break;
case ARG_IMAGE_POLICY:
arg_root = strdup("/sysusr");
if (!arg_root)
return log_oom();
+
+ arg_relax_copy_block_security = true;
}
if (argc > optind) {
r = context_open_copy_block_paths(
context,
loop_device ? loop_device->devno : /* if --image= is specified, only allow partitions on the loopback device */
- arg_root && !arg_image ? 0 : /* if --root= is specified, don't accept any block device */
+ /* if --root= is specified, don't accept any block device, unless it
+ * was set automatically because we are in the initrd */
+ arg_root && !arg_image && !arg_relax_copy_block_security ? 0 :
(dev_t) -1); /* if neither is specified, make no restrictions */
if (r < 0)
return r;