From 8c1be37e5b438bfdb640cfd39700bf074c66820c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 1 Dec 2016 20:25:26 +0100 Subject: util-lib: split out image dissecting code and loopback code from nspawn This adds two new APIs to systemd: - loop-util.h is a simple internal API for allocating, setting up and releasing loopback block devices. - dissect-image.h is an internal API for taking apart disk images and figuring out what the purpose of each partition is. Both APIs are basically refactored versions of similar code in nspawn. This rework should permit us to reuse this in other places than just nspawn in the future. Specifically: to implement RootImage= in the service image, similar to RootDirectory=, but operating on a disk image; to unify the gpt-auto-discovery generator code with the discovery logic in nspawn; to add new API to machined for determining the OS version of a disk image (i.e. not just running containers). This PR does not make any such changes however, it just provides the new reworked API. The reworked code is also slightly more powerful than the nspawn original one. When pointing it to an image or block device with a naked file system (i.e. no partition table) it will simply make it the root device. --- .gitignore | 1 + 1 file changed, 1 insertion(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 21fcf9841c..405b07ef4d 100644 --- a/.gitignore +++ b/.gitignore @@ -180,6 +180,7 @@ /test-dhcp-option /test-dhcp-server /test-dhcp6-client +/test-dissect-image /test-dns-domain /test-dns-packet /test-dnssec -- cgit v1.2.1 From a2ea3b2fc82bdd92cf782de61365113bb6ed9ca7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 2 Dec 2016 19:32:09 +0100 Subject: dissect: add small "systemd-dissect" tool as wrapper around dissect-image.c This adds a small tool that may be used to look into OS images, and mount them to any place. This is mostly a friendlier version of test-dissect-image.c. I am not sure this should really become a proper command of systemd, hence for now do not install it into bindir, but simply libexecdir. This tool is already pretty useful since you can mount image files with it, honouring the various partitions correctly. I figure this is going to become more interesting if the dissctor learns luks and verity support. --- .gitignore | 1 + 1 file changed, 1 insertion(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 405b07ef4d..baa975d813 100644 --- a/.gitignore +++ b/.gitignore @@ -67,6 +67,7 @@ /systemd-debug-generator /systemd-delta /systemd-detect-virt +/systemd-dissect /systemd-escape /systemd-export /systemd-firstboot -- cgit v1.2.1