1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rainloop_ynh.git synced 2024-09-03 20:16:18 +02:00
rainloop_ynh/scripts/upgrade
polytan02 e87b84a31f Rainloop for Yunohost
Rainloop is a lightweight webmail.
2015-02-01 19:20:54 +00:00

35 lines
1.1 KiB
Bash

#!/bin/bash
domain=$(sudo yunohost app setting rainloop domain)
path=$(sudo yunohost app setting rainloop path)
deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
db_user=rainloop
db_pwd=$(sudo yunohost app setting rainloop mysqlpwd)
db_file=../sources/SQL/mysql/$(ls -tr -1 ../sources/SQL/mysql | head -1)
mysql -u $db_user -p$db_pwd $db_user < $db_file
mysql -u $db_user -p$db_pwd $db_user < ../sources/plugins/automatic_addressbook/SQL/mysql.initial.sql
final_path=/var/www/rainloop
sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
sudo mkdir -p $final_path/logs
sudo chown -R www-data:www-data $final_path
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/rainloop.conf
sed -i "s@NAMETOCHANGE@rainloop@g" ../conf/php-fpm.conf
finalphpconf=/etc/php5/fpm/pool.d/rainloop.conf
sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf
sudo chmod 644 $finalphpconf
sudo service php5-fpm restart
sudo service nginx reload
sudo yunohost app ssowatconf