1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/thelounge_ynh.git synced 2024-09-03 20:35:54 +02:00
thelounge_ynh/scripts/upgrade

51 lines
1.4 KiB
Text
Raw Normal View History

2015-08-22 20:24:46 +02:00
#!/bin/bash
set -e
# Retrieve arguments
domain=$(sudo yunohost app setting shout domain)
path=$(sudo yunohost app setting shout path)
is_public=$(sudo yunohost app setting shout is_public)
final_path=/var/www/shout
# Remove trailing "/" from the path
path=${path%/}
# Copy files to the right place
sudo mkdir -p $final_path/.shout/users
sudo cp -a ../sources/* $final_path/
# Set permissions
sudo chown -hR shout $final_path
# Install dependencies
sudo su -c "cd $final_path && /usr/bin/npm install --production" shout
# Modify Nginx configuration file and copy it to Nginx conf directory
if [[ "$path" == "" ]]; then
sed -i "s@LOCATIONTOCHANGE@/@g" ../conf/nginx.conf
else
sed -i "s@LOCATIONTOCHANGE@$path@g" ../conf/nginx.conf
fi
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/shout.conf
# Copy systemd service
sudo cp ../conf/systemd.service /etc/systemd/system/shout.service
# Add YunoHost service
sudo yunohost service add shout -l /var/log/syslog \
|| echo "Service already exist"
# Make app public if necessary
sudo yunohost app setting shout is_public -v "$is_public"
if [ "$is_public" = "Yes" ];
then
sudo yunohost app setting shout unprotected_uris -v "/"
fi
# Reload Nginx, shout and regenerate SSOwat conf
sudo service nginx reload
sudo systemctl enable shout
sudo systemctl start shout || sudo systemctl restart shout
sudo yunohost app ssowatconf