1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cops_ynh.git synced 2024-09-03 18:25:57 +02:00
cops_ynh/scripts/upgrade
2016-12-21 23:57:11 +00:00

60 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
set -eu
# Charge les fonctions génériques habituellement utilisées dans le script
source fonctions
# Active trap pour arrêter le script si une erreur est détectée.
TRAP_ON
# Source app helpers
source /usr/share/yunohost/helpers
# We retrieve app parameters
app=$YNH_APP_INSTANCE_NAME
# We check variables are not empty
CHECK_VAR "$app" "app name not set"
path=$(ynh_app_setting_get $app path)
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path)
sitename=$(ynh_app_setting_get $app sitename)
finalnginxconf=$(ynh_app_setting_get $app finalnginxconf)
finalphpconf=$(ynh_app_setting_get $app finalphpconf)
usergroup=$(ynh_app_setting_get $app usergroup)
# Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf $finalnginxconf
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
sed -i "s@FOLDERTOCHANGE@$finalpath@g" ../conf/php-fpm.conf
sed -i "s@USERTOCHANGE@$usergroup@g" ../conf/php-fpm.conf
sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf
sudo chmod 644 $finalphpconf
# We adjust permissions
sudo chmod 775 -R $final_path
sudo chown -hR $usergroup $final_path
# Make app public if necessary
is_public=$(ynh_app_setting_get $app is_public)
if [ "$is_public" = "Yes" ];
then
ynh_app_setting_set $app skipped_uris "/"
else
ynh_app_setting_set $app protected_uris "/"
fi
# Reload Nginx and regenerate SSOwat conf
sudo service php5-fpm reload
sudo service nginx reload
sudo yunohost app ssowatconf