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/upgrade

60 lines
1.8 KiB
Text
Raw Normal View History

2013-12-11 18:29:43 +01:00
#!/bin/bash
# Get app settings
domain=$(sudo yunohost app setting radicale domain)
path=$(sudo yunohost app setting radicale path)
2014-05-29 11:36:34 +02:00
# Check depends installation
sudo apt-get install -y python-pip python-virtualenv python-dev libldap2-dev libsasl2-dev libssl-dev uwsgi uwsgi-plugin-python
2014-05-29 12:53:53 +02:00
if [ -d /usr/local/radicale ];
then
2014-05-29 13:44:20 +02:00
sudo mkdir -p /opt/yunohost
2014-05-29 13:43:57 +02:00
sudo mv /usr/local/radicale /opt/yunohost/
2014-05-29 12:53:53 +02:00
fi
# Set permissions to radicale directory
2014-05-29 13:59:30 +02:00
sudo grep radicaled /etc/passwd > /dev/null 2>&1
if [ $? != 0 ];
then
sudo useradd radicale -d /opt/yunohost/radicale
fi
2014-05-29 13:14:22 +02:00
sudo chown radicale:radicale -R /opt/yunohost/radicale
2014-05-29 11:36:34 +02:00
# Upgrade pip packages
sudo bash -c "source /opt/yunohost/radicale/bin/activate && pip install radicale python-ldap --upgrade"
# Radicale configuration
sudo cp ../conf/config /etc/radicale/
sudo cp ../conf/logging /etc/radicale/
2015-01-14 10:52:09 +01:00
sudo cp ../conf/rights /etc/radicale/
2014-05-29 11:36:34 +02:00
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
2014-05-29 13:48:34 +02:00
# Copy uwsgi config
sudo cp ../conf/radicale.ini /etc/uwsgi/apps-available/
2014-05-29 14:04:56 +02:00
# Update nginx config
2014-05-31 11:52:49 +02:00
sudo find /etc/nginx/conf.d/ -name radicale.conf -exec sed -i 's@tmp\/radicale.sock@run\/uwsgi\/app\/radicale\/socket@' {} \;
2014-05-29 14:04:56 +02:00
2014-01-06 09:38:16 +01:00
# Fix permission
sudo chmod 755 /etc/radicale/
2014-05-29 13:14:22 +02: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:38:16 +01:00
sudo chmod 644 /etc/radicale/*
2014-05-29 13:43:57 +02:00
sudo chown -R radicale $final_path
2014-05-29 13:42:06 +02:00
sudo touch /var/log/radicale
sudo chgrp radicale /var/log/radicale
sudo chmod g+w /var/log/radicale
2014-01-06 09:38:16 +01:00
2014-05-29 11:36:34 +02:00
sudo yunohost app setting radicale skipped_uris -v "/"
sudo yunohost app ssowatconf
2014-01-06 09:38:16 +01:00
sudo service uwsgi stop
sudo killall uwsgi
sudo service uwsgi start
sudo service nginx reload