2015-04-08 09:22:42 -05:00
|
|
|
#!/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
|
|
|
|
|
|
|
|
cd $CHROOT || 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
|
2015-04-23 07:23:42 -05:00
|
|
|
find /etc/passwd /etc/group /etc/hosts \
|
|
|
|
/etc/resolv.conf \
|
|
|
|
/lib/ld-* /lib64/ld-* \
|
2015-04-27 04:00:31 -05:00
|
|
|
/etc/ld.so.* \
|
2015-04-23 07:23:42 -05:00
|
|
|
/lib/libnss_* /lib64/libnss_* \
|
2015-04-27 04:00:31 -05:00
|
|
|
/usr/share/fonts \
|
2015-04-23 07:23:42 -05:00
|
|
|
/etc/fonts -type f
|
2015-04-08 09:22:42 -05:00
|
|
|
|
|
|
|
# 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
|
|
|
|
) |
|
|
|
|
|
|
|
|
while read file; do
|
2015-04-23 07:18:22 -05:00
|
|
|
cp --parents $file .
|
2015-04-08 09:22:42 -05:00
|
|
|
done
|