2013-11-28 17:44:39 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
domain=$1
|
|
|
|
path=$2
|
|
|
|
|
|
|
|
# Check domain/path availability
|
2013-11-30 15:31:51 +01:00
|
|
|
yunohost app checkurl $domain$path -a radicale
|
|
|
|
sudo yunohost app setting radicale skipped_uris -v "$path"
|
|
|
|
if [[ ! $? -eq 0 ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2013-11-28 17:44:39 +01:00
|
|
|
|
2013-11-28 19:24:55 +01:00
|
|
|
# Check depends installation
|
2013-11-30 15:31:51 +01:00
|
|
|
for i in python-pip python-virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python
|
2013-11-28 19:24:55 +01:00
|
|
|
do
|
|
|
|
dpkg -l | grep $i > /dev/null 2>&1
|
|
|
|
if [ $? = 1 ];
|
|
|
|
then
|
|
|
|
sudo apt-get install $i -y
|
|
|
|
fi
|
|
|
|
done
|
2013-11-28 17:44:39 +01:00
|
|
|
|
|
|
|
# Init virtualenv
|
|
|
|
sudo virtualenv /usr/local/radicale
|
2013-11-30 15:31:51 +01:00
|
|
|
sudo bash -c "source /usr/local/radicale/bin/activate && pip install radicale python-ldap"
|
|
|
|
deactivate
|
2013-11-28 17:44:39 +01:00
|
|
|
|
2013-11-28 19:24:55 +01:00
|
|
|
#Configuration Radicale
|
|
|
|
if [ ! -d /etc/radicale ];
|
|
|
|
then
|
2013-11-30 15:31:51 +01:00
|
|
|
sudo mkdir /etc/radicale
|
2013-11-28 19:24:55 +01:00
|
|
|
fi
|
2013-11-30 15:31:51 +01:00
|
|
|
sudo cp ../conf/config /etc/radicale/
|
|
|
|
sudo cp ../conf/logging /etc/radicale/
|
|
|
|
|
|
|
|
# Copy files to the right place
|
|
|
|
final_path=/var/www/radicale
|
|
|
|
sudo mkdir -p $final_path/collections
|
|
|
|
sudo cp ../conf/radicale.wsgi $final_path
|
2013-11-28 17:44:39 +01:00
|
|
|
|
|
|
|
# Set permissions to radicale directory
|
2013-11-30 15:31:51 +01:00
|
|
|
sudo chown -R www-data. $final_path
|
|
|
|
sudo touch /var/log/radicale
|
|
|
|
sudo chgrp /var/log/radicale
|
|
|
|
sudo chmod g+w /var/log/radicale
|
2013-11-28 17:44:39 +01:00
|
|
|
|
2013-11-30 15:31:51 +01:00
|
|
|
# Copy uwsgi config
|
|
|
|
cp ../conf/radicale.ini /etc/uwsgi/apps-available/
|
|
|
|
ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
|
2013-11-28 17:44:39 +01:00
|
|
|
|
2013-11-30 15:31:51 +01:00
|
|
|
## Modify Nginx configuration file and copy it to Nginx conf directory
|
|
|
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
|
|
|
cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/radicale.conf
|
|
|
|
|
|
|
|
## Reload Nginx and regenerate SSOwat conf
|
|
|
|
service nginx reload
|
|
|
|
service uwsgi reload
|
|
|
|
yunohost app setting radicale skipped_uris -v "$path"
|
|
|
|
yunohost app ssowatconf
|