#!/bin/bash # Retrieve arguments domain=$1 path="/Microsoft-Server-ActiveSync" # Check domain/path availability sudo yunohost app checkurl $domain$path -a z-push if [[ ! $? -eq 0 ]]; then exit 1 fi # Prereqs sudo apt_install php-soap php5-imap libawl-php php5-xsl libawl-php # Copy files to the right place final_path=/var/www/z-push sudo mkdir -p $final_path sudo cp -a ../sources/* $final_path # Set permissions to roundcube directory sudo chown -R www-data: $final_path # Configuration sudo cp ../conf/config.php $final_path/ sudo sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" $final_path/config.php sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" $final_path/config.php # Create directory sudo mkdir -p /var/log/z-push sudo chmod 750 /var/log/z-push sudo chown www-data:www-data /var/log/z-push #Copy XMLElement.php sudo ln -s /usr/share/awl/inc/XMLElement.php /var/www/z-push/include/ # Modify Nginx configuration file and copy it to Nginx conf directory sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/z-push.conf # Enable api for client sudo yunohost app setting z-push skipped_uris -v "/" # Reload Nginx and regenerate SSOwat conf sudo service nginx reload sudo yunohost app ssowatconf