[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#636697: initramfs-tools: no way to include library modules for libraries installed in multiarch path



Package: initramfs-tools
Version: 0.99
Severity: normal


Hello

initramfs-tools hook-functions include copy_exec function that copies an
executable including all required libraries, possibly including
libraries in some odd places like /lib32 /lib64 /lib/i386-linux-gnu,
etc.

However, some libraries use modules which are dynamically loaded and are
not copied by cope_exec. This includes libc nss modules, pango, pixbuf
and gtk modules, etc.

At the very least the libc nss modules are required in intramfs to get
dns lookup for netbooting. Splashscreen solutions like plymouth might
need some of the graphics rendering modules.

It is possible to require libraries to install some module lists which
would allow initramfs-tools to copy these modules automagically whenever
a library is copied into initramfs. There are multiple problems, though.
The module list would have to be maintained in different package than
the one where it is used (live-boot vs libc, plymouth vs pango) leading
to bitrot. The other issue is that not all modules are required. libc
has some 4-5 nss modules but only 1-2 are used in initramfs.

The solution I would like to propose requires some knowledge of the library in
the package that includes it in initramfs but lets initramfs-tools locate the
exact place where the library is located in the system. It requires that any
dynamically loaded modules always reside in the same path relative to the
library which seems to be the case with current packages and is generally
sensible.

This simple additional function in hook-functions should allow initramfs hooks
to install loadable modules effortlessly.

Thanks

Michal

# include a module dynamically loaded by a library
# $1 - directory to search for the library (may be / to search all of initramfs)
# $2 - library to search for
# $3 - module to include relative to library found
# example: lib_module /lib 'libc.so.*' 'libnss_dns.so.*'
#	   lib_module /usr/lib 'libpango-*.so.*' 'pango/*/modules/pango-basic-fc.so'
# Does not handle spaces in directory or module names and .. in module names.
lib_module()
{
	local dir lib mod lib_dir i j
	dir="$1"
	lib="$2"
	mod="$3"
	{ find "${DESTDIR}${dir}" -name "${lib}" -type l
	  find "${DESTDIR}${dir}" -name "${lib}" -type f ; } | { while read i ; do
		lib_dir="$(dirname "$i" | sed -e "s ^${DESTDIR}  " )"
		ls "${lib_dir}"/${mod} | { while read j ; do
			copy_exec "$j"
		done ; }
	done ; }
}



Reply to: