2014-07-12 00:02:32 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Z-Push: The Microsoft Exchange protocol server.
|
|
|
|
# Mostly for use on iOS which doesn't support IMAP.
|
|
|
|
#
|
|
|
|
# Although Ubuntu ships Z-Push (as d-push) it has a dependency on Apache
|
|
|
|
# so we won't install it that way.
|
|
|
|
#
|
|
|
|
# Thanks to http://frontender.ch/publikationen/push-mail-server-using-nginx-and-z-push.html.
|
|
|
|
|
|
|
|
source setup/functions.sh # load our functions
|
|
|
|
source /etc/mailinabox.conf # load global vars
|
|
|
|
|
|
|
|
# Prereqs.
|
|
|
|
|
|
|
|
apt_install \
|
2014-08-12 11:22:34 +00:00
|
|
|
php-soap php5-imap libawl-php php5-xsl
|
2014-07-12 00:02:32 +00:00
|
|
|
|
|
|
|
php5enmod imap
|
|
|
|
|
|
|
|
# Copy Z-Push into place.
|
2014-08-12 12:03:36 +00:00
|
|
|
needs_update=0
|
|
|
|
if [ ! -f /usr/local/lib/z-push/version ]; then
|
|
|
|
needs_update=1
|
|
|
|
elif [[ `curl -s https://api.github.com/repos/fmbiete/Z-Push-contrib/git/refs/heads/master` != `cat /usr/local/lib/z-push/version` ]]; then
|
|
|
|
# checks if the version
|
|
|
|
needs_update=1
|
|
|
|
fi
|
|
|
|
if [ $needs_update == 1 ]; then
|
|
|
|
rm -rf /usr/local/lib/z-push
|
2014-08-11 17:08:02 +00:00
|
|
|
rm -f /tmp/zpush.zip
|
2014-08-12 23:10:51 +00:00
|
|
|
echo installing z-push \(fmbiete fork\)...
|
2014-08-11 17:08:02 +00:00
|
|
|
wget -qO /tmp/zpush.zip https://github.com/fmbiete/Z-Push-contrib/archive/master.zip
|
2014-08-12 12:03:36 +00:00
|
|
|
unzip -q /tmp/zpush.zip -d /usr/local/lib/
|
2014-08-11 17:08:02 +00:00
|
|
|
mv /usr/local/lib/Z-Push-contrib-master /usr/local/lib/z-push
|
2014-08-12 12:03:36 +00:00
|
|
|
rm -f /usr/sbin/z-push-{admin,top}
|
2014-07-12 00:02:32 +00:00
|
|
|
ln -s /usr/local/lib/z-push/z-push-admin.php /usr/sbin/z-push-admin
|
|
|
|
ln -s /usr/local/lib/z-push/z-push-top.php /usr/sbin/z-push-top
|
2014-08-11 17:08:02 +00:00
|
|
|
rm /tmp/zpush.zip;
|
2014-08-12 12:03:36 +00:00
|
|
|
curl -s https://api.github.com/repos/fmbiete/Z-Push-contrib/git/refs/heads/master > /usr/local/lib/z-push/version
|
2014-07-12 00:02:32 +00:00
|
|
|
fi
|
|
|
|
|
2014-08-12 12:03:36 +00:00
|
|
|
# Configure default config.
|
|
|
|
sed -i "s/define('TIMEZONE', .*/define('TIMEZONE', 'Etc\/UTC');/" /usr/local/lib/z-push/config.php
|
2014-08-11 17:08:02 +00:00
|
|
|
sed -i "s/define('BACKEND_PROVIDER', .*/define('BACKEND_PROVIDER', 'BackendCombined');/" /usr/local/lib/z-push/config.php
|
|
|
|
|
|
|
|
# Configure BACKEND
|
|
|
|
rm -f /usr/local/lib/z-push/backend/combined/config.php
|
2014-08-11 17:42:52 +00:00
|
|
|
cp conf/zpush/backend_combined.php /usr/local/lib/z-push/backend/combined/config.php
|
2014-08-11 17:08:02 +00:00
|
|
|
|
2014-08-11 17:42:52 +00:00
|
|
|
# Configure IMAP
|
|
|
|
rm -f /usr/local/lib/z-push/backend/imap/config.php
|
|
|
|
cp conf/zpush/backend_imap.php /usr/local/lib/z-push/backend/imap/config.php
|
2014-07-12 00:02:32 +00:00
|
|
|
|
2014-08-11 17:08:02 +00:00
|
|
|
# Configure CardDav
|
2014-08-11 17:42:52 +00:00
|
|
|
rm -f /usr/local/lib/z-push/backend/carddav/config.php
|
|
|
|
cp conf/zpush/backend_carddav.php /usr/local/lib/z-push/backend/carddav/config.php
|
2014-08-11 17:08:02 +00:00
|
|
|
|
|
|
|
# Configure CalDav
|
2014-08-11 17:42:52 +00:00
|
|
|
rm -f /usr/local/lib/z-push/backend/caldav/config.php
|
|
|
|
cp conf/zpush/backend_caldav.php /usr/local/lib/z-push/backend/caldav/config.php
|
2014-07-12 00:02:32 +00:00
|
|
|
|
2014-08-19 11:03:44 +00:00
|
|
|
# Configure Autodiscover
|
|
|
|
rm -f /usr/local/lib/z-push/autodiscover/config.php
|
|
|
|
cp conf/zpush/autodiscover_config.php /usr/local/lib/z-push/autodiscover/config.php
|
|
|
|
|
2014-07-12 00:02:32 +00:00
|
|
|
# Some directories it will use.
|
|
|
|
|
|
|
|
mkdir -p /var/log/z-push
|
|
|
|
mkdir -p /var/lib/z-push
|
|
|
|
chmod 750 /var/log/z-push
|
|
|
|
chmod 750 /var/lib/z-push
|
|
|
|
chown www-data:www-data /var/log/z-push
|
|
|
|
chown www-data:www-data /var/lib/z-push
|
|
|
|
|
|
|
|
# Restart service.
|
|
|
|
|
2014-08-11 23:15:17 +00:00
|
|
|
restart_service php5-fpm
|