<command>cfdisk /dev/loop/by-ref/quux</command>.</para></listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--mtree-hash=no</option></term>
+
+ <listitem><para>If combined with <option>--mtree</option>, turns off inclusion of file hashes in the
+ mtree output. This makes the <option>--mtree</option> faster when operating on large images.
+ </para></listitem>
+ </varlistentry>
+
<xi:include href="standard-options.xml" xpointer="image-policy-open" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
<xi:include href="standard-options.xml" xpointer="no-legend" />
static char **arg_argv = NULL;
static char *arg_loop_ref = NULL;
static ImagePolicy* arg_image_policy = NULL;
+static bool arg_mtree_hash = true;
STATIC_DESTRUCTOR_REGISTER(arg_image, freep);
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
" --json=pretty|short|off\n"
" Generate JSON output\n"
" --loop-ref=NAME Set reference string for loopback device\n"
+ " --mtree-hash=BOOL Whether to include SHA256 hash in the mtree output\n"
"\n%3$sCommands:%4$s\n"
" -h --help Show this help\n"
" --version Show package version\n"
ARG_LOOP_REF,
ARG_IMAGE_POLICY,
ARG_VALIDATE,
+ ARG_MTREE_HASH,
};
static const struct option options[] = {
{ "loop-ref", required_argument, NULL, ARG_LOOP_REF },
{ "image-policy", required_argument, NULL, ARG_IMAGE_POLICY },
{ "validate", no_argument, NULL, ARG_VALIDATE },
+ { "mtree-hash", required_argument, NULL, ARG_MTREE_HASH },
{}
};
arg_action = ACTION_VALIDATE;
break;
+ case ARG_MTREE_HASH:
+ r = parse_boolean_argument("--mtree-hash=", optarg, &arg_mtree_hash);
+ if (r < 0)
+ return r;
+ break;
+
case '?':
return -EINVAL;
ansi_normal(),
(uint64_t) sx->stx_size);
- if (inode_fd >= 0 && sx->stx_size > 0) {
+ if (arg_mtree_hash && inode_fd >= 0 && sx->stx_size > 0) {
uint8_t hash[SHA256_DIGEST_SIZE];
r = get_file_sha256(inode_fd, hash);
systemd-dissect "${image}.raw" | grep -q -F -f <(sed 's/"//g' "$os_release")
systemd-dissect --list "${image}.raw" | grep -q '^etc/os-release$'
-systemd-dissect --mtree "${image}.raw" | grep -q "./usr/bin/cat type=file mode=0755 uid=0 gid=0"
+systemd-dissect --mtree "${image}.raw" --mtree-hash yes | grep -qe "^./usr/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]* sha256sum=[a-z0-9]*$"
+systemd-dissect --mtree "${image}.raw" --mtree-hash no | grep -qe "^./usr/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]*$"
read -r SHA256SUM1 _ < <(systemd-dissect --copy-from "${image}.raw" etc/os-release | sha256sum)
test "$SHA256SUM1" != ""