Hello ,

The script just worked . Thanks a lot Aiko for that script, and thanks to 
everybody for  the suggestions and help. Now the convert command 
runs , and i can see the web application shows me an image where it
supposed to be showd, but i still have some errors though , but i 
guess they are about the programming of this web application . 
I know that on the old server (lionux)  it  worked just fine with 
the code as it is (php5), but maybe has to be changed because 
of the chroot , i don't know , i'll try to contact the programmer to 
let him see it .
 
Thanks ,
Marcos 

----- Original Message ----- 
From: "Aiko Barz" <[EMAIL PROTECTED]>
To: "Marcos Laufer" <[EMAIL PROTECTED]>
Cc: <misc@openbsd.org>
Sent: Thursday, May 17, 2007 2:51 PM
Subject: Re: ImageMagick and chroot


: <[EMAIL PROTECTED]>

Marcos Laufer wrote:
> Hello ,
> 
> Has anyone had luck in making ImageMagick work into the www chroot
> environment?

Yes, run the following script and you are done.

#!/bin/sh


CHROOT="/var/www"


# Make dirs
[ ! -d "$CHROOT/bin" ]              && mkdir -p $CHROOT/bin
[ ! -d "$CHROOT/usr/local/bin" ]    && mkdir -p $CHROOT/usr/local/bin
[ ! -d "$CHROOT/usr/local/lib" ]    && mkdir -p $CHROOT/usr/local/lib
[ ! -d "$CHROOT/usr/lib" ]          && mkdir -p $CHROOT/usr/lib
[ ! -d "$CHROOT/usr/X11R6/lib" ]    && mkdir -p $CHROOT/usr/X11R6/lib/
[ ! -d "$CHROOT/usr/libexec" ]      && mkdir -p $CHROOT/usr/libexec
[ ! -d "$CHROOT/var/run" ]          && mkdir -p $CHROOT/var/run


SH="/bin/sh"
if [ -x $SH ]; then
    cp -f $SH $CHROOT/$SH
else
    echo "No shit. $SH not found! :)"
fi


LD_HINTS="/var/run/ld.so.hints"
if [ -f $LD_HINTS ]; then
    cp $LD_HINTS $CHROOT/$LD_HINTS
else
    echo "$LD_HINTS not found. Still wondering thou."
fi


CONVERT=$(which convert | awk '{print $1}')
if [ ! -z $CONVERT ] && [ -x $CONVERT ]; then
    cp -f $CONVERT $CHROOT/$CONVERT
    for i in $(ldd $CONVERT | awk '{if ($3 == "rlib") {print $7}}'); do
        if [ -f $i ]; then
            cp -f $i $CHROOT/$i
        fi
    done
else
    echo "convert not found."
    exit 1
fi


COMPOSITE=$(which composite | awk '{print $1}')
if [ ! -z $COMPOSITE ] && [ -x $COMPOSITE ]; then
    cp -f $COMPOSITE $CHROOT/$COMPOSITE
    for i in $(ldd $COMPOSITE | awk '{if ($3 == "rlib") {print $7}}'); do
        if [ -f $i ]; then
            cp -f $i $CHROOT/$i
        fi
    done
else
    echo "composite not found."
    exit 1
fi


IDENTIFY=$(which identify | awk '{print $1}')
if [ ! -z $IDENTIFY ] && [ -x $IDENTIFY ]; then
    cp -f $IDENTIFY $CHROOT/$IDENTIFY
    for i in $(ldd $IDENTIFY | awk '{if ($3 == "rlib") {print $7}}'); do
        if [ -f $i ]; then
            cp -f $i $CHROOT/$i
        fi
    done
else
    echo "identify not found."
    exit 1
fi

HTH,
    Aiko
-- 
Aiko Barz <[EMAIL PROTECTED]>
Web: http://www.haeckser.de

Reply via email to