111 lines
3.8 KiB
Bash
111 lines
3.8 KiB
Bash
#! /bin/sh
|
|
|
|
exec 2>&1
|
|
|
|
#/bin/mount --bind /var/qmail/bin/ root/var/qmail/bin
|
|
if [ ! -f root/var/qmail/bin/ ]; then
|
|
cp -a /var/qmail/bin/* root/var/qmail/bin/
|
|
mv root/var/qmail/bin/qmail-remote root/var/qmail/bin/qmail-remote.real
|
|
cp -a qmail-remote-throttle root/var/qmail/bin/qmail-remote
|
|
|
|
fi
|
|
|
|
if [ ! -d root/etc ]; then
|
|
mkdir root/etc
|
|
cp -a /etc/resolv.conf root/etc
|
|
cp -a /etc/services root/etc
|
|
cp -a /etc/passwd root/etc
|
|
cp -a /etc/group root/etc
|
|
fi
|
|
|
|
LIBDIR="lib"
|
|
LIBC="2.17"
|
|
if [ -d /lib64 ]; then
|
|
LIBDIR="lib64"
|
|
fi
|
|
|
|
if [ ! -d root/$LIBDIR ]; then
|
|
mkdir root/$LIBDIR
|
|
cp -a /$LIBDIR/libc-$LIBC.so root/$LIBDIR
|
|
ln -s libc-$LIBC.so root/$LIBDIR/libc.so.6
|
|
cp -a /$LIBDIR/ld-$LIBC.so root/$LIBDIR
|
|
if [ -d /lib64 ]; then
|
|
ln -s ld-$LIBC.so root/$LIBDIR/ld-linux-x86-64.so.2
|
|
else
|
|
ln -s ld-$LIBC.so root/$LIBDIR/ld-linux.so.2
|
|
fi
|
|
cp -a /$LIBDIR/libnss_files-$LIBC.so root/$LIBDIR
|
|
ln -s libnss_files-$LIBC.so root/$LIBDIR/libnss_files.so.2
|
|
cp -a /$LIBDIR/libresolv-$LIBC.so root/$LIBDIR
|
|
ln -s libresolv-$LIBC.so root/$LIBDIR/libresolv.so.2
|
|
|
|
## added for throttle
|
|
# for perl /usr/bin/perl
|
|
#cp --parents `ldd BIN_PATH | cut -d " " -f 3` CHROOT_PATH
|
|
#cp -a --parents `ldd /usr/bin/perl | cut -d " " -f 3` root/
|
|
# wold almost work inside a loop checking if link and cpying also the target
|
|
cp -a --parents /usr/$LIBDIR/perl5/CORE/libperl.so root/
|
|
cp -a --parents /$LIBDIR/libresolv.so.2 root/
|
|
cp -a --parents /$LIBDIR/libnsl.so.1 root/
|
|
cp -a --parents /$LIBDIR/libnsl-$LIBC.so root/
|
|
cp -a --parents /$LIBDIR/libdl.so.2 root/
|
|
cp -a --parents /$LIBDIR/libdl-$LIBC.so root/
|
|
cp -a --parents /$LIBDIR/libm.so.6 root/
|
|
cp -a --parents /$LIBDIR/libm-$LIBC.so root/
|
|
cp -a --parents /$LIBDIR/libcrypt.so.1 root/
|
|
cp -a --parents /$LIBDIR/libcrypt-$LIBC.so root/
|
|
cp -a --parents /$LIBDIR/libutil.so.1 root/
|
|
cp -a --parents /$LIBDIR/libutil-$LIBC.so root/
|
|
cp -a --parents /$LIBDIR/libpthread.so.0 root/
|
|
cp -a --parents /$LIBDIR/libpthread-$LIBC.so root/
|
|
cp -a --parents /lib64/libfreebl3.so root/
|
|
|
|
cp -a --parents /usr/$LIBDIR/perl5/Fcntl.pm root/
|
|
cp -a --parents /usr/$LIBDIR/perl5/auto/Fcntl root/
|
|
cp -a --parents /usr/share/perl5/strict.pm root/
|
|
cp -a --parents /usr/share/perl5/AutoLoader.pm root/
|
|
cp -a --parents /usr/share/perl5/Carp.pm root/
|
|
cp -a --parents /usr/share/perl5/Carp/Heavy.pm root/
|
|
cp -a --parents /usr/share/perl5/Exporter.pm root/
|
|
cp -a --parents /usr/share/perl5/Exporter root/
|
|
cp -a --parents /usr/share/perl5/warnings.pm root/
|
|
|
|
cp -a --parents /usr/$LIBDIR/perl5/XSLoader.pm root/
|
|
cp -a --parents /usr/$LIBDIR/perl5/DynaLoader.pm root/
|
|
cp -a --parents /usr/$LIBDIR/perl5/Config.pm root/
|
|
cp -a --parents /usr/$LIBDIR/perl5/Config_heavy.pl root/
|
|
cp -a --parents /usr/$LIBDIR/perl5/Config_git.pl root/
|
|
cp -a --parents /usr/$LIBDIR/perl5/auto/DynaLoader/dl_findfile.al root/
|
|
|
|
# might better somewhere else
|
|
cp -a --parents /usr/bin/perl root/
|
|
# this one is needed to set locale for perl
|
|
cp -a --parent /usr/lib/locale root/
|
|
|
|
#bin sh for qmail-qstat
|
|
cp -a --parents /bin/sh root/
|
|
cp -a --parents /bin/bash root/
|
|
cp -a --parents /$LIBDIR/libtinfo.so.5 root/
|
|
cp -a --parents /$LIBDIR/libtinfo.so.5.7 root/
|
|
|
|
cp -a --parents /usr/bin/wc root/
|
|
cp -a --parents /bin/find root/
|
|
cp -a --parents /usr/bin/expr root/
|
|
cp -a --parents /$LIBDIR/libselinux.so.1 root/
|
|
cp -a --parents /$LIBDIR/librt.so.1 root/
|
|
cp -a --parents /$LIBDIR/librt-2.12.so root/
|
|
cp -a --parents /usr/$LIBDIR/libgmp.so.3 root/
|
|
cp -a --parents /usr/$LIBDIR/libgmp.so.3.5.0 root/
|
|
|
|
|
|
fi
|
|
|
|
chown qmails:qmail root/var/qmail/queue/lock/trigger
|
|
chmod 622 root/var/qmail/queue/lock/trigger
|
|
|
|
exec \
|
|
/usr/bin/env - PATH="/var/qmail/bin:/bin:/usr/bin:/usr/local/bin" \
|
|
/usr/sbin/chroot root /var/qmail/bin/qmail-start \
|
|
./Maildir/
|
|
|