George Prekas
2022-Apr-06 21:15 UTC
[Libguestfs] [supermin PATCH v2 0/1] Fix for missing /lib/modules.
v1: https://listman.redhat.com/archives/libguestfs/2022-April/028564.html v2 addresses feedback from Laszlo Ersek: keep previous logic in a try/with block. George Prekas (1): Fix for missing /lib/modules. src/format_ext2.ml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) -- 2.35.1
George Prekas
2022-Apr-06 21:15 UTC
[Libguestfs] [supermin PATCH v2 1/1] Fix for missing /lib/modules.
Even when supplied with $SUPERMIN_MODULES, supermin tries to access /lib/modules. This directory does not exist by default in all the environments. --- src/format_ext2.ml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/format_ext2.ml b/src/format_ext2.ml index e311ea6..2888ed8 100644 --- a/src/format_ext2.ml +++ b/src/format_ext2.ml @@ -95,8 +95,18 @@ let build_ext2 debug basedir files modpath kernel_version appliance size printf "supermin: ext2: copying kernel modules\n%!"; (* Import the kernel modules. *) - ext2fs_copy_file_from_host fs "/lib" "/lib"; - ext2fs_copy_file_from_host fs "/lib/modules" "/lib/modules"; + (try + ext2fs_copy_file_from_host fs "/lib" "/lib"; + with Unix_error _ -> + ext2fs_copy_file_from_host fs "/" "/lib"; + ); + + (try + ext2fs_copy_file_from_host fs "/lib/modules" "/lib/modules"; + with Unix_error _ -> + ext2fs_copy_file_from_host fs "/" "/lib/modules"; + ); + ext2fs_copy_dir_recursively_from_host fs modpath ("/lib/modules/" ^ kernel_version); -- 2.35.1