1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/radicale_ynh.git synced 2024-09-03 20:16:14 +02:00
radicale_ynh/scripts/install
2015-09-18 15:39:04 +02:00

64 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a radicale
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Check depends installation
sudo apt-get install -y python-pip python-virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python
# Init virtualenv
sudo virtualenv /opt/yunohost/radicale
sudo /opt/yunohost/radicale/bin/pip install radicale==0.10 python-ldap
#Configuration Radicale
if [ ! -d /etc/radicale ];
then
sudo mkdir /etc/radicale
fi
sudo cp ../conf/config /etc/radicale/
sudo cp ../conf/logging /etc/radicale/
sudo cp ../conf/rights /etc/radicale/
sudo sed -i "s@CHANGEPATH@$path@g" /etc/radicale/config
# Copy files to the right place
final_path=/var/www/radicale
sudo mkdir -p $final_path/collections
sudo cp ../conf/radicale.wsgi $final_path
# Set permissions to radicale directory
sudo useradd radicale -d /opt/yunohost/radicale
sudo chown radicale:radicale -R /opt/yunohost/radicale
# Set permissions to radicale directory
sudo chown -R radicale. $final_path
sudo touch /var/log/radicale
sudo chgrp radicale /var/log/radicale
sudo chmod g+w /var/log/radicale
# Copy uwsgi config
sudo cp ../conf/radicale.ini /etc/uwsgi/apps-available/
sudo ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
# Modify Nginx configuration file and copy it to Nginx conf directory
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/radicale.conf
# Fix permission
sudo chmod 755 /etc/radicale/
sudo find /opt/yunohost/radicale/ -type d -exec chmod 2755 {} \;
sudo find /opt/yunohost/radicale/ -type f -exec chmod g+r,o+r {} \;
sudo chmod 644 /etc/radicale/*
## Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo service uwsgi restart
sudo yunohost service add uwsgi -l /var/log/uwsgi/app/radicale.log
sudo yunohost app setting radicale skipped_uris -v "/"
sudo yunohost app ssowatconf