1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minchat_ynh.git synced 2024-09-03 19:36:29 +02:00
minchat_ynh/scripts/install
2015-05-20 23:22:42 +02:00

38 lines
No EOL
1,002 B
Bash

#!/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
if [[ ! -f ${final_path}/conf/setup.ini ]] ; then
sudo cp ${final_path}/conf/sample/setup.ini ${final_path}/conf/
fi
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