2015-04-08 09:22:42 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-06-08 08:58:34 -05:00
|
|
|
test $# -eq 2 || { echo "Usage: $0 <chroot template directory for system libs to create> <LO installation directory>"; exit 1; }
|
2015-04-08 09:22:42 -05:00
|
|
|
|
|
|
|
# No provision for spaces or other weird characters in pathnames. So sue me.
|
|
|
|
|
|
|
|
CHROOT=$1
|
|
|
|
INSTDIR=$2
|
|
|
|
|
2015-08-14 03:30:45 -05:00
|
|
|
test -d "$INSTDIR" || { echo "No such directory: $INSTDIR"; exit 1; }
|
|
|
|
|
2017-09-22 10:04:29 -05:00
|
|
|
mkdir -p $CHROOT || exit 1
|
2015-04-08 09:22:42 -05:00
|
|
|
|
2015-04-29 07:02:59 -05:00
|
|
|
CHROOT=`cd $CHROOT && /bin/pwd`
|
|
|
|
INSTDIR=`cd $INSTDIR && /bin/pwd`
|
|
|
|
|
|
|
|
cd / || exit 1
|
2015-04-08 09:22:42 -05:00
|
|
|
|
|
|
|
(
|
2016-01-14 11:14:35 -06:00
|
|
|
# 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-* \
|
|
|
|
lib/libcap* lib64/libcap* lib/*-linux-gnu/libcap* \
|
|
|
|
lib/libattr* lib/*-linux-gnu/libattr* \
|
|
|
|
etc/ld.so.* \
|
|
|
|
lib/libnss_* lib64/libnss_* lib/*-linux-gnu/libnss*\
|
|
|
|
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/share/zoneinfo/* \
|
|
|
|
usr/share/liblangtag \
|
2017-03-27 04:57:43 -05:00
|
|
|
usr/lib/libpng* usr/lib64/libpng* lib/*-linux-gnu/libpng* \
|
2017-07-11 05:39:10 -05:00
|
|
|
usr/lib/*-linux-gnu/liblcms2* \
|
2016-01-14 11:14:35 -06:00
|
|
|
-type f
|
|
|
|
|
|
|
|
find etc/fonts \
|
|
|
|
lib/ld-* lib64/ld-* \
|
|
|
|
lib/libnss_* lib64/libnss_* lib/*-linux-gnu/libnss*\
|
|
|
|
lib/libcap* lib64/libcap* lib/*-linux-gnu/libcap* \
|
|
|
|
lib/libattr* lib/*-linux-gnu/libattr* \
|
2017-03-27 04:57:43 -05:00
|
|
|
usr/lib/libpng* usr/lib64/libpng* lib/*-linux-gnu/libpng* \
|
2017-07-11 05:39:10 -05:00
|
|
|
usr/lib/*-linux-gnu/liblcms2* \
|
2016-01-14 11:14:35 -06:00
|
|
|
-type l
|
|
|
|
|
|
|
|
# Go through the LO shared objects and check what system libraries
|
|
|
|
# they link to.
|
2017-07-11 05:39:10 -05:00
|
|
|
find $INSTDIR -name '*.so' -o -name '*.so.[0-9]*' -o -name 'xpdfimport' |
|
2016-01-14 11:14:35 -06:00
|
|
|
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,^/,,'
|
|
|
|
|
2015-04-08 09:22:42 -05:00
|
|
|
) |
|
|
|
|
|
2015-04-29 07:02:59 -05:00
|
|
|
# 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
|
2015-04-27 07:49:25 -05:00
|
|
|
|
2015-07-18 13:28:12 -05:00
|
|
|
mkdir -p $CHROOT/tmp
|
|
|
|
|
2015-04-27 07:49:25 -05:00
|
|
|
# /usr/share/fonts needs to be taken care of separately because the
|
2016-04-15 08:23:44 -05:00
|
|
|
# directory time stamps must be preserved for fontconfig to trust
|
2015-04-27 07:49:25 -05:00
|
|
|
# its cache.
|
|
|
|
|
2015-04-29 07:02:59 -05:00
|
|
|
cd $CHROOT || exit 1
|
|
|
|
|
2016-02-29 06:25:12 -06:00
|
|
|
mkdir -p usr/share || exit 1
|
2016-06-29 09:01:26 -05:00
|
|
|
cp -r -p -L /usr/share/fonts usr/share
|
2016-02-29 06:25:12 -06:00
|
|
|
|
|
|
|
if [ -h usr/share/fonts/ghostscript ]; then
|
|
|
|
mkdir usr/share/ghostscript || exit 1
|
2016-06-29 09:01:26 -05:00
|
|
|
cp -r -p -L /usr/share/ghostscript/fonts usr/share/ghostscript
|
2015-04-29 07:02:59 -05:00
|
|
|
fi
|
2016-04-15 08:23:44 -05:00
|
|
|
|
2016-04-15 08:34:23 -05:00
|
|
|
# Debugging only hackery to avoid confusion.
|
2016-04-15 08:23:44 -05:00
|
|
|
if test "z$ENABLE_DEBUG" != "z" -a "z$HOME" != "z"; then
|
|
|
|
echo "Copying development users's fonts into systemplate"
|
|
|
|
mkdir -p $CHROOT/$HOME
|
2016-12-16 20:17:44 -06:00
|
|
|
mkdir -p $CHROOT/$HOME/docs
|
2016-04-15 09:19:04 -05:00
|
|
|
test -d $HOME/.fonts && cp -r -p -L $HOME/.fonts $CHROOT/$HOME
|
2016-12-16 20:17:44 -06:00
|
|
|
test -d $HOME/docs && cp -r -p -L $HOME/docs $CHROOT/$HOME
|
2016-04-15 08:23:44 -05:00
|
|
|
fi
|
2016-04-15 09:19:04 -05:00
|
|
|
|
|
|
|
exit 0
|