ImageMagick to Chrooted Apache PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Bart Dorlandt   
Saturday, 01 December 2007 22:10

I've made a script to make an upgrade of OpenBSD just a little bit easier when you use ImageMagick in your Chrooted environment. This script copies 3 executables and its libraries to the chrooted environment lvarlwww. It will also check if files already exist and have the correct permissions.

After finishing this script it is ready to use for Gallery2 and Joomla! for example. Well you might want to check this piece.

Here is the script:

#!/bin/sh
IMAGEMAGICK="/usr/local/bin/composite /usr/local/bin/convert /usr/local/bin/identify"

if [ ! -d /var/www/usr/local/bin ]; then mkdir -p /var/www/usr/local/bin ;fi
if [ ! -d /var/www/usr/local/lib ]; then mkdir -p /var/www/usr/local/lib ;fi
if [ ! -d /var/www/usr/libexec ];   then mkdir -p /var/www/usr/libexec; fi
if [ ! -d /var/www/usr/lib ];       then mkdir -p /var/www/usr/lib ;fi

LOCALBIN=`ldd $IMAGEMAGICK | grep -v : | grep usr | awk '{print $7}' | grep bin`
LOCALLIB=`ldd $IMAGEMAGICK | grep -v : | grep usr | awk '{print $7}' | grep local | grep -v libexec | grep lib`
LIB=`ldd $IMAGEMAGICK | grep -v : | grep usr | awk '{print $7}' | grep -v local | grep -v libexec | grep lib`
LIBEXEC=`ldd $IMAGEMAGICK | grep -v : | grep usr | awk '{print $7}' | grep libexec`

for x in $LOCALBIN
do
if [ ! -x /var/www${x} ]; then
cp -p $x /var/www${x}
echo Copied $x
else
echo /var/www$x already executable
fi
done

for x in $LOCALLIB
do
if [ ! -r /var/www${x} ]; then
cp -p $x /var/www${x}
echo Copied $x
else
echo /var/www$x already readable
fi
done

for x in $LIB
do
if [ ! -r /var/www${x} ]; then
cp -p $x /var/www${x}
echo Copied $x
else
echo /var/www$x already readable
fi
done

for x in $LIBEXEC
do
if [ ! -r /var/www${x} ]; then
cp -p $x /var/www${x}
echo Copied $x
else
echo /var/www$x already readable
fi
done

Last Updated on Friday, 13 February 2009 15:28
 


Related items: