1dbc88a32b
Originally all was good, thenad21717498
removed these files from jail, therefore name resolution broke, thenac7d67f43e
added back libnss_* libs from one location, which happened to work on developer's computer, then4e5528e5f8
,b4f15c714a
, and9c0ab72155
added back etc/hosts etc/nsswitch.conf etc/resolv.conf that were also needed for proper name resolution, finally this patch adds some more possible locations of Name Service Switch (NSS) libs, therefore it makes sure that the required libnss_* shared libs are found e.g. on Debian based systems. Also, testing with libreoffice/online docker image has shown that libresolv.so.2 is also required in systemplate for name resolution, although on some other systems it was not needed (preload?). This fixes two bugs: 1) Linked images in documents were not displayed on certain systems 2) Insert image from WOPI host did not work on certain systems Change-Id: I5d09a65341050f0f729bdbc46977c0f686ac023c Reviewed-on: https://gerrit.libreoffice.org/64426 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
91 lines
2.5 KiB
Bash
Executable file
91 lines
2.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
test $# -eq 2 || { echo "Usage: $0 <chroot template directory for system libs to create> <LO installation directory>"; exit 1; }
|
|
|
|
# No provision for spaces or other weird characters in pathnames. So sue me.
|
|
|
|
CHROOT=$1
|
|
INSTDIR=$2
|
|
|
|
test -d "$INSTDIR" || { echo "No such directory: $INSTDIR"; exit 1; }
|
|
|
|
mkdir -p $CHROOT || exit 1
|
|
|
|
CHROOT=`cd $CHROOT && /bin/pwd`
|
|
INSTDIR=`cd $INSTDIR && /bin/pwd`
|
|
|
|
cd / || exit 1
|
|
|
|
(
|
|
# Produce a list of file names, one per line, that will be copied
|
|
# into the template tree of system files for the chroot jails.
|
|
|
|
# First essential files and shared objects
|
|
find etc/hosts etc/nsswitch.conf etc/resolv.conf \
|
|
etc/ld.so.* \
|
|
lib/ld-* lib64/ld-* \
|
|
lib/libnss_* lib64/libnss_* lib/*/libnss_* \
|
|
lib/libresolv* lib64/libresolv* lib/*/libresolv* \
|
|
var/cache/fontconfig \
|
|
etc/fonts \
|
|
etc/localtime \
|
|
usr/lib/locale/en_US.utf8 \
|
|
usr/lib/locale/C.UTF-8 \
|
|
usr/lib/locale/locale_archive \
|
|
usr/lib/*/nss/*.so \
|
|
usr/lib/*/libsqlite* \
|
|
usr/share/zoneinfo/* \
|
|
usr/share/liblangtag \
|
|
usr/share/hyphen \
|
|
-type f 2>/dev/null
|
|
|
|
find etc/fonts \
|
|
etc/resolv.conf \
|
|
lib/ld-* lib64/ld-* \
|
|
lib/libnss_* lib64/libnss_* lib/*/libnss_* \
|
|
lib/libresolv* lib64/libresolv* lib/*/libresolv* \
|
|
usr/lib/*/libsqlite* \
|
|
-type l 2>/dev/null
|
|
|
|
# Go through the LO shared objects and check what system libraries
|
|
# they link to.
|
|
find $INSTDIR -name 'xpdfimport' |
|
|
while read file; do
|
|
ldd $file 2>/dev/null
|
|
done |
|
|
grep -v dynamic | cut -d " " -f 3 | grep -E '^(/lib|/usr)' | sort -u | sed -e 's,^/,,'
|
|
|
|
) |
|
|
|
|
# Can't use -l because then symlinks won't be handled well enough.
|
|
# This will now copy the file a symlink points to, but whatever.
|
|
cpio -p -d -L $CHROOT
|
|
|
|
mkdir -p $CHROOT/tmp
|
|
|
|
# /usr/share/fonts needs to be taken care of separately because the
|
|
# directory time stamps must be preserved for fontconfig to trust
|
|
# its cache.
|
|
|
|
cd $CHROOT || exit 1
|
|
|
|
mkdir -p usr/share || exit 1
|
|
cp -r -p -L /usr/share/fonts usr/share
|
|
|
|
if [ -h usr/share/fonts/ghostscript ]; then
|
|
mkdir usr/share/ghostscript || exit 1
|
|
cp -r -p -L /usr/share/ghostscript/fonts usr/share/ghostscript
|
|
fi
|
|
|
|
# Remove obsolete & unused bitmap fonts
|
|
find usr/share -name '*.pcf' | xargs rm -f
|
|
find usr/share -name '*.pcf.gz' | xargs rm -f
|
|
|
|
# Debugging only hackery to avoid confusion.
|
|
if test "z$ENABLE_DEBUG" != "z" -a "z$HOME" != "z"; then
|
|
echo "Copying development users's fonts into systemplate"
|
|
mkdir -p $CHROOT/$HOME
|
|
test -d $HOME/.fonts && cp -r -p -L $HOME/.fonts $CHROOT/$HOME
|
|
fi
|
|
|
|
exit 0
|