1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/z-push_ynh.git synced 2024-09-03 18:05:58 +02:00
z-push_ynh/scripts/install
2014-12-18 17:47:35 +01:00

45 lines
1.2 KiB
Bash

#!/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
# 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
# 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_urls -v "/"
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf