2016-06-14 12:25:46 +02:00
|
|
|
#!/bin/bash
|
2014-11-12 22:42:09 +01:00
|
|
|
|
|
|
|
app=pluxml
|
|
|
|
|
|
|
|
#retrieve arguments
|
|
|
|
domain=$(sudo yunohost app setting $app domain)
|
|
|
|
path=$(sudo yunohost app setting $app path)
|
|
|
|
admin=$(sudo yunohost app setting $app admin)
|
|
|
|
is_public=$(sudo yunohost app setting $app is_public)
|
|
|
|
|
|
|
|
# Remove trailing "/" for next commands
|
|
|
|
path=${path%/}
|
|
|
|
|
|
|
|
# Copy source files
|
2016-06-15 20:17:31 +02:00
|
|
|
src_path=/var/www/$app
|
|
|
|
sudo mkdir -p $src_path
|
|
|
|
sudo cp -a ../sources/* $src_path
|
|
|
|
sudo find $src_path -type f -name ".htaccess" | xargs sudo rm
|
|
|
|
sudo rm $src_path/install.php
|
2014-11-12 22:42:09 +01:00
|
|
|
|
2016-06-15 20:17:31 +02:00
|
|
|
sudo chown -R root: $src_path
|
2016-06-15 20:25:51 +02:00
|
|
|
sudo chown -R www-data: $src_path/{data, plugins}
|
2016-06-15 20:17:31 +02:00
|
|
|
sudo find $src_path -type f | xargs sudo chmod 644
|
|
|
|
sudo find $src_path -type d | xargs sudo chmod 755
|
2014-11-17 14:14:56 +01:00
|
|
|
|
2014-11-12 22:42:09 +01:00
|
|
|
#configure nginx settings
|
2016-06-15 20:25:51 +02:00
|
|
|
nginx_conf="../conf/nginx.conf"
|
|
|
|
sudo sed -i "s@YNH_EXAMPLE_PATH@$path@g" $nginx_conf
|
|
|
|
sudo sed -i "s@YNH_EXAMPLE_ALIAS@$src_path@g" $nginx_conf
|
|
|
|
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
2014-11-12 22:42:09 +01:00
|
|
|
|
|
|
|
# If app is public, add url to SSOWat conf as skipped_uris
|
2016-06-14 12:55:55 +02:00
|
|
|
if [ "$is_public" = "Yes" ]; then
|
2014-11-17 14:04:17 +01:00
|
|
|
sudo yunohost app setting $app unprotected_uris -v "/"
|
2014-11-12 22:42:09 +01:00
|
|
|
fi
|
|
|
|
|
2016-06-14 12:55:55 +02:00
|
|
|
# Reload nginx service
|
2014-11-12 22:42:09 +01:00
|
|
|
sudo service nginx reload
|