2015-04-06 17:46:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
# Installation de minchat dans Yunohost
|
|
|
|
app=minchat
|
|
|
|
|
|
|
|
# Retrieve arguments
|
|
|
|
domain=$1
|
|
|
|
path=$2
|
|
|
|
is_public=$3
|
|
|
|
|
|
|
|
# Check domain/path availability
|
|
|
|
sudo yunohost app checkurl $domain$path -a $app
|
|
|
|
if [[ ! $? -eq 0 ]]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Copy files to the right place with the right permissions
|
|
|
|
final_path=/var/www/$app
|
|
|
|
sudo mkdir -p $final_path
|
|
|
|
sudo cp -a ../sources/* $final_path
|
2015-05-20 23:07:46 +02:00
|
|
|
if [[ ! -f ${final_path}/conf/setup.ini ]] ; then
|
2015-05-20 23:22:42 +02:00
|
|
|
sudo cp ${final_path}/conf/sample/setup.ini ${final_path}/conf/
|
2015-05-20 23:07:46 +02:00
|
|
|
fi
|
2015-04-06 17:46:57 +02:00
|
|
|
sudo chown -R www-data: $final_path
|
|
|
|
|
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
|
|
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
|
|
|
sed -i "s@WWWPATH@$final_path@g" ../conf/nginx.conf
|
|
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
|
|
|
|
# Make it public is required
|
|
|
|
if [[ $is_public =~ ^[Yy]$ ]]
|
|
|
|
then
|
|
|
|
sudo yunohost app setting $app skipped_uris -v "/"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Reload nginx and regenerate SSOwat conf
|
|
|
|
sudo service nginx reload
|
|
|
|
sudo yunohost app ssowatconf
|