2013-12-06 17:19:45 +01:00
|
|
|
#!/bin/bash
|
2016-05-10 14:21:26 +02:00
|
|
|
|
|
|
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
2016-05-04 14:53:55 +02:00
|
|
|
set -e
|
2013-12-06 17:19:45 +01:00
|
|
|
|
2016-05-04 14:53:55 +02:00
|
|
|
app=${!#}
|
2013-12-06 17:19:45 +01:00
|
|
|
|
2016-05-04 14:53:55 +02:00
|
|
|
domain=$(sudo yunohost app setting $app domain)
|
|
|
|
path=$(sudo yunohost app setting $app path)
|
2013-12-06 17:19:45 +01:00
|
|
|
|
2016-05-04 14:53:55 +02:00
|
|
|
db_user=$app
|
|
|
|
db_pwd=$(sudo yunohost app setting $app mysqlpwd)
|
|
|
|
|
|
|
|
final_path=/var/www/$app
|
2013-12-06 17:19:45 +01:00
|
|
|
sudo mkdir -p $final_path
|
|
|
|
|
2013-12-11 19:50:13 +01:00
|
|
|
sudo cp -a ../source/* $final_path
|
2013-12-06 17:19:45 +01:00
|
|
|
sudo cp ../conf/config.php $final_path/
|
2015-02-20 10:05:57 +01:00
|
|
|
sudo cp ../conf/*.patch /tmp/
|
2015-02-20 09:47:33 +01:00
|
|
|
sudo patch -d $final_path -p0 < /tmp/update.patch
|
|
|
|
sudo patch -d $final_path/plugins/auth_remote/ -p0 < /tmp/init.patch
|
2013-12-06 17:19:45 +01:00
|
|
|
|
|
|
|
# Change variables in ttrss configuration
|
|
|
|
sudo sed -i "s/yunouser/$db_user/g" $final_path/config.php
|
|
|
|
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config.php
|
|
|
|
sudo sed -i "s/yunobase/$db_user/g" $final_path/config.php
|
|
|
|
sudo sed -i "s,yunopath,https://$domain$path,g" $final_path/config.php
|
|
|
|
|
|
|
|
sudo chown -R www-data: $final_path
|
|
|
|
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
|
|
sudo sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
|
|
|
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
2016-05-04 14:53:55 +02:00
|
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
2013-12-06 17:19:45 +01:00
|
|
|
|
|
|
|
sudo service nginx reload
|
|
|
|
sudo yunohost app ssowatconf
|
2016-05-04 14:53:55 +02:00
|
|
|
sudo yunohost app setting $app skipped_uris -v "/public.php,/api"
|
2014-12-17 10:44:31 +01:00
|
|
|
|
2014-12-17 11:11:08 +01:00
|
|
|
# Update database schema
|
2014-12-17 13:02:57 +01:00
|
|
|
sudo su - www-data -c "$final_path/update.php --update-schema"
|