@@ -50,39 +50,75 @@ To run the command line tool in the activated environment::
5050 ./extractcode -h
5151
5252
53- Adding support for VM images
54- ----------------------------
53+ Adding support for VM images extraction
54+ ---------------------------------------
5555
56- Adding support for VM images requires the manual installation of libguestfs and
57- it Python binding. You will need to install the libguestfs tools system package.
58- On Debian and Ubuntu ::
56+ Adding support for VM images requires the manual installation of libguestfs
57+ tools system package. This is suport on Linux only. On Debian and Ubuntu you can
58+ use this ::
5959
6060 sudo apt-get install libguestfs-tools
6161
6262
63- On Ubuntu, a manual stpe is required if the kernel executable file cannot be read.
64- This is required by guestfish and libguestfs and this is an oddity there and not on Debian .
63+ On Ubuntu only, an additional manual step is required as the kernel executable
64+ file cannot be read as required by libguestfish .
6565
66- Run this command as a temporary fix::
66+ Run this command as a temporary and immediate fix::
6767
6868 for k in /boot/vmlinuz-*
69- do sudo dpkg-statoverride --add --update root root 0644 /boot/vmlinuz-$(uname -r)
69+ do sudo dpkg-statoverride --add --update root root 0644 /boot/vmlinuz-$k
7070 done
7171
72- or::
7372
74- sudo chmod +r /boot/vmlinuz-*,
73+ But you likely want both this temporary fix and a permanent fix; otherwise each
74+ kernel update will revert to the default permissions and extractcode will stop
75+ working for VM images extraction.
7576
77+ Therefore follow these instructions:
7678
77- For a permanent fix see:
79+ 1. As sudo, create the file /etc/kernel/postinst.d/statoverride with this
80+ content, devised by Kees Cook (@kees) in
81+ https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725/comments/3 ::
7882
79- - https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1813662/comments/21
83+ #!/bin/sh
84+ version="$1"
85+ # passing the kernel version is required
86+ [ -z "${version}" ] && exit 0
87+ dpkg-statoverride --update --add root root 0644 /boot/vmlinuz-${version}
8088
81- See also for a discussion:
82-
83- - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
84- - https://bugzilla.redhat.com/show_bug.cgi?id=1670790
85- - https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1813662
89+ 2. Set executable permissions::
8690
91+ sudo chmod +x /etc/kernel/postinst.d/statoverride
8792
93+ See also for a complete discussion:
8894
95+ - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/759725
96+ - https://bugzilla.redhat.com/show_bug.cgi?id=1670790
97+ - https://bugs.launchpad.net/ubuntu/+source/libguestfs/+bug/1813662/comments/24
98+
99+
100+ Configuration with environment variables
101+ ----------------------------------------
102+
103+ ExtractCode will use these environment variables if set:
104+
105+ - EXTRACTCODE_GUESTFISH_PATH : the path to the ``guestfish `` tool from
106+ libguestfs to use to extract VM images. If not provided, ExtractCode will look
107+ in the PATH for an installed ``guestfish `` executable instead.
108+
109+ - EXTRACTCODE_LIBARCHIVE_PATH : the path to the ``libarchive.so `` libarchive
110+ shared library used to support some of the archive formats. If not provided,
111+ ExtractCode will look for a plugin-provided libarchive library path. See
112+ https://github.com/nexB/scancode-plugins/tree/main/builtins for such plugins.
113+
114+ If no plugin contributes libarchive, then a final attempt is made to look for
115+ it in the PATH using standard DLL loading techniques.
116+
117+ - EXTRACTCODE_7Z_PATH : the path to the ``7z `` 7zip executable used to support
118+ some of the archive formats. If not provided, ExtractCode will look for a
119+ plugin-provided 7z executable path. See
120+ https://github.com/nexB/scancode-plugins/tree/main/builtins for such plugins.
121+
122+ If no plugin contributes 7z, then a final attempt is made to look for
123+ it in the PATH.
124+
0 commit comments