dissect: Allow a few verbs to operate on directories as well as image files

--copy-to, --copy-from, --list and --mtree are useful for image directories
as well as image files, so for those verbs, let's check if we were passed
a directory and skip all the image file setup if that's the case.
This commit is contained in:
Daan De Meyer
2023-07-06 12:11:42 +02:00
parent a130b09513
commit 2292fa1e31
3 changed files with 151 additions and 106 deletions
+10
View File
@@ -540,6 +540,16 @@ systemctl stop test-root-ephemeral
timeout 10 bash -c 'while ! test -z "$(ls -A /var/lib/systemd/ephemeral-trees)"; do sleep .5; done'
test ! -f /tmp/img/abc
systemd-dissect --mtree /tmp/img
systemd-dissect --list /tmp/img
read -r SHA256SUM1 _ < <(systemd-dissect --copy-from /tmp/img etc/os-release | sha256sum)
test "$SHA256SUM1" != ""
echo abc > abc
systemd-dissect --copy-to /tmp/img abc /abc
test -f /tmp/img/abc
echo OK >/testok
exit 0