1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/leed_ynh.git synced 2024-09-03 19:26:32 +02:00
leed_ynh/scripts/upgrade
2014-08-20 13:21:06 +02:00

39 lines
1.3 KiB
Bash

#!/bin/bash
# Retrieve arguments
domain=$(sudo yunohost app setting leed domain)
path=$(sudo yunohost app setting leed path)
language=$(sudo yunohost app setting leed language)
is_public=$(sudo yunohost app setting leed is_public)
# Copy files to right place
final_path=/var/www/leed
sudo mkdir -p $final_path
sudo cp -a ../sources/* $final_path
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/leed.conf
# Set right permissions
sudo chown -R www-data: $final_path
# Change variables in Leed configuration
sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/leed.conf
sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/leed.conf
# Réglage de la langue choisie
sudo sed -i "s@define('LANGUAGE','.*');@define('LANGUAGE','$language');@" $final_path/constant.php
# Make app private if necessary
sudo yunohost app setting leed is_public -v "$is_public"
if [ "$is_public" = "No" ];
then
# Retire l'autorisation d'accès de la page d'install.
sudo yunohost app setting leed skipped_uris -d
# Rend la page d'actualisation accessible pour le script cron.
sudo yunohost app setting leed skipped_uris -v "/action.php"
else # Si l'app est publique
sudo yunohost app setting leed skipped_uris -v "/"
fi
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf