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

65 lines
1.9 KiB
Text
Raw Normal View History

2013-11-28 17:44:39 +01:00
#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
# Check domain/path availability
2013-11-30 20:59:09 +01:00
sudo yunohost app checkurl $domain$path -a radicale
2013-11-30 15:31:51 +01:00
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
2014-01-06 09:34:23 +01:00
sudo apt-get install -y python-pip python-virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python
2013-11-28 17:44:39 +01:00
# Init virtualenv
2014-03-10 11:32:41 +01:00
sudo virtualenv /opt/yunohost/radicale
2015-09-16 15:03:11 +02:00
sudo /opt/yunohost/radicale/bin/pip install radicale==1.0 python-ldap
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/
2015-01-14 10:50:51 +01:00
sudo cp ../conf/rights /etc/radicale/
2014-01-23 17:18:28 +01:00
sudo sed -i "s@CHANGEPATH@$path@g" /etc/radicale/config
2013-11-30 15:31:51 +01:00
# Copy files to the right place
final_path=/var/www/radicale
2014-01-23 17:31:30 +01:00
sudo mkdir -p $final_path/collections
2013-11-30 15:31:51 +01:00
sudo cp ../conf/radicale.wsgi $final_path
2013-11-28 17:44:39 +01:00
2015-04-26 15:05:08 +02:00
# Set permissions to radicale directory
2014-05-29 13:39:48 +02:00
sudo useradd radicale -d /opt/yunohost/radicale
sudo chown radicale:radicale -R /opt/yunohost/radicale
2013-11-28 17:44:39 +01:00
# Set permissions to radicale directory
2014-05-29 13:39:48 +02:00
sudo chown -R radicale. $final_path
2013-11-30 15:31:51 +01:00
sudo touch /var/log/radicale
2014-05-29 13:39:48 +02:00
sudo chgrp radicale /var/log/radicale
2013-11-30 15:31:51 +01:00
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
2013-11-30 20:26:40 +01:00
sudo cp ../conf/radicale.ini /etc/uwsgi/apps-available/
sudo ln -s /etc/uwsgi/apps-available/radicale.ini /etc/uwsgi/apps-enabled/
2013-11-28 17:44:39 +01:00
2014-01-06 09:29:29 +01:00
# Modify Nginx configuration file and copy it to Nginx conf directory
2013-11-30 20:26:40 +01:00
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/radicale.conf
2013-11-30 15:31:51 +01:00
2014-01-06 09:29:29 +01:00
# Fix permission
sudo chmod 755 /etc/radicale/
2014-03-10 11:32:41 +01:00
sudo find /opt/yunohost/radicale/ -type d -exec chmod 2755 {} \;
sudo find /opt/yunohost/radicale/ -type f -exec chmod g+r,o+r {} \;
2014-01-06 09:29:29 +01:00
sudo chmod 644 /etc/radicale/*
2013-11-30 15:31:51 +01:00
## Reload Nginx and regenerate SSOwat conf
2013-11-30 20:26:40 +01:00
sudo service nginx reload
2013-11-30 20:28:49 +01:00
sudo service uwsgi restart
2014-12-04 21:42:38 +01:00
sudo yunohost service add uwsgi -l /var/log/uwsgi/app/radicale.log
2013-12-07 20:52:10 +01:00
sudo yunohost app setting radicale skipped_uris -v "/"
2013-11-30 20:59:09 +01:00
sudo yunohost app ssowatconf