#!/bin/sh # # sqmail.cgi automatic installer for SquirrelMail # # Instruction for people who already has extratools.php: # # Click on "install/update sqmail.cgi" in extratools.php # Then click on the link in "access this link to use it ==> sqmail.cgi" # # Instruction for people who has a protected directory # or who know how to protect: # # Put this script in a protected directory and chmod 700, # then access it onece: http://yourdomain.com/protected_dir/sqmail.cgi # # SquirrelMail will be ready in: http://yourdomain.com/sqmail/ # (Use the user/pass for email shown in OPS->package->pop/imap to login.) # # If you don't know how how to protect a directory, please use extratools.php. # http://check-these.info/tools/extratools_php.txt # echo -e "Content-type: text/html\n\n
"
exec 2>&1
VER=1.4.5
SQMAIL=squirrelmail
cd $DOCUMENT_ROOT
wget -nd http://easynews.dl.sourceforge.net/sourceforge/squirrelmail/$SQMAIL-$VER.tar.bz2
tar -xjvf $SQMAIL-$VER.tar.bz2
mv -v $SQMAIL-$VER sqmail
cd sqmail
pwd
cp -v config/config_default.php config/config.php
echo "\$domain = '${HTTP_HOST#www.}';"
perl -i -pe "s#^(.domain = ).*#\$1'${HTTP_HOST#www.}';#" config/config.php
echo "\$imapServername = 'mail.${HTTP_HOST#www.}';"
perl -i -pe "s#^(.imapServername = ).*#\$1'mail.${HTTP_HOST#www.}';#" config/config.php
echo 'all done'
echo "Log in SquirrelMail at http://$HTTP_HOST/sqmail/"