From 332782bc13af57e04146a78a00cd6d457e2be9c0 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 3 Dec 2014 17:21:15 +0100 Subject: [PATCH] Adapt chroot setup to work on x86_64 and SME9 --- root/var/service/altqmail/finish | 2 +- root/var/service/altqmail/run | 36 +++++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/root/var/service/altqmail/finish b/root/var/service/altqmail/finish index 5fb8159..2497530 100644 --- a/root/var/service/altqmail/finish +++ b/root/var/service/altqmail/finish @@ -2,4 +2,4 @@ umount /var/service/altqmail/root/var/qmail/bin rm -rf root/etc -rm -rf root/lib +rm -rf root/lib{,64} diff --git a/root/var/service/altqmail/run b/root/var/service/altqmail/run index d0c22f7..d2c2ad7 100644 --- a/root/var/service/altqmail/run +++ b/root/var/service/altqmail/run @@ -2,7 +2,7 @@ exec 2>&1 -mount --bind /var/qmail/bin/ root/var/qmail/bin +/bin/mount --bind /var/qmail/bin/ root/var/qmail/bin if [ ! -d root/etc ]; then mkdir root/etc @@ -12,16 +12,29 @@ if [ ! -d root/etc ]; then cp -a /etc/group root/etc fi -if [ ! -d root/lib ]; then - mkdir root/lib - cp -a /lib/libc-2.5.so root/lib - ln -s libc-2.5.so root/lib/libc.so.6 - cp -a /lib/ld-2.5.so root/lib/ - ln -s ld-2.5.so root/lib/ld-linux.so.2 - cp -a /lib/libnss_files-2.5.so root/lib - ln -s libnss_files-2.5.so root/lib/libnss_files.so.2 - cp -a /lib/libresolv-2.5.so root/lib - ln -s libresolv-2.5.so root/lib/libresolv.so.2 +LIBDIR="lib" +LIBC="2.5" +if [ -d /lib64 ]; then + LIBDIR="lib64" +fi +if [ -e /$LIBDIR/libc-2.12.so ]; then + LIBC="2.12" +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 fi chown qmails:qmail root/var/qmail/queue/lock/trigger @@ -31,3 +44,4 @@ exec \ /usr/bin/env - PATH="/var/qmail/bin:/bin:/usr/bin:/usr/local/bin" \ /usr/sbin/chroot root /var/qmail/bin/qmail-start \ ./Maildir/ +