3ea260f972
Allow the directory parameters to be relative paths; turn them into absolute ones for later use in the script as we change directories back and forth. Use cpio instead of cp --parent for each file separately. (The latter has the problem that parent directories are created using the protection the corresponding source directory has, and tht might not permit you to copy other files later into the same directory.) Also copy usr/share/liblangtag, for the (common) case when LibreOffice is built to use a system liblangtag. Don't bother with the special handling of /usr/share/fonts/ghostscript unless it exists and is a symlink. With these changes, it worked for CentOS 7, too.
57 lines
1.5 KiB
Bash
Executable file
57 lines
1.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
test $# -eq 2 || { echo "Usage: $0 <chroot template directory> <LO installation directory>"; exit 1; }
|
|
|
|
# No provision for spaces or other weird characters in pathnames. So sue me.
|
|
|
|
CHROOT=$1
|
|
INSTDIR=$2
|
|
|
|
mkdir $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/passwd etc/group etc/hosts \
|
|
etc/resolv.conf \
|
|
lib/ld-* lib64/ld-* \
|
|
etc/ld.so.* \
|
|
lib/libnss_* lib64/libnss_* \
|
|
var/cache/fontconfig \
|
|
etc/fonts \
|
|
usr/share/liblangtag \
|
|
-type f
|
|
|
|
# Go through the LO shared objects and check what system libraries
|
|
# they link to.
|
|
find $INSTDIR -name '*.so' -o -name '*.so.[0-9]*' |
|
|
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
|
|
|
|
# /usr/share/fonts needs to be taken care of separately because the
|
|
# directory time stamps must be preserved are for fontconfig to trust
|
|
# its cache.
|
|
|
|
cd $CHROOT || exit 1
|
|
|
|
mkdir -p usr/share || exit 1
|
|
cp -r -p /usr/share/fonts usr/share
|
|
|
|
if [ -h usr/share/fonts/ghostscript ]; then
|
|
mkdir usr/share/ghostscript || exit 1
|
|
cp -r -p /usr/share/ghostscript/fonts usr/share/ghostscript
|
|
fi
|