2015-11-11 18:03:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-03-08 00:50:23 +01:00
|
|
|
source .fonctions # Loads the generic functions usually used in the script
|
|
|
|
source /usr/share/yunohost/helpers # Source YunoHost helpers
|
2017-03-02 15:44:54 +01:00
|
|
|
|
|
|
|
# See comments in install script
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
# Retrieve app settings
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
path=$(ynh_app_setting_get "$app" path)
|
|
|
|
admin=$(ynh_app_setting_get "$app" admin)
|
|
|
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
|
|
|
language=$(ynh_app_setting_get "$app" language)
|
|
|
|
|
2017-03-08 00:50:23 +01:00
|
|
|
CHECK_PATH # Checks and corrects the syntax of the path.
|
2015-11-11 18:03:16 +01:00
|
|
|
|
|
|
|
# Check if admin is not null
|
2017-03-02 15:44:54 +01:00
|
|
|
if [[ "$admin" = "" || "$is_public" = "" || "$language" = "" ]]; then
|
2015-11-11 18:03:16 +01:00
|
|
|
echo "Unable to upgrade, please contact support"
|
2017-03-02 15:44:54 +01:00
|
|
|
ynh_die
|
2015-11-11 18:03:16 +01:00
|
|
|
fi
|
|
|
|
|
2017-03-02 15:44:54 +01:00
|
|
|
final_path=/var/www/$app
|
|
|
|
|
2015-11-11 18:03:16 +01:00
|
|
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
2017-03-09 17:27:59 +01:00
|
|
|
sed -i "s@__PATHTOCHANGE__@$app@g" ../conf/nginx.conf*
|
|
|
|
sed -i "s@__FINALPATH__@$final_path/@g" ../conf/nginx.conf*
|
2015-11-11 18:03:16 +01:00
|
|
|
|
2017-03-09 17:27:59 +01:00
|
|
|
# If app is public, add url to SSOWat conf as skipped_uris
|
2015-11-11 18:03:16 +01:00
|
|
|
if [ $is_public = "Yes" ];
|
|
|
|
then
|
2017-03-02 15:44:54 +01:00
|
|
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
2017-03-09 17:27:59 +01:00
|
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
2015-11-11 18:03:16 +01:00
|
|
|
else
|
2017-03-02 15:44:54 +01:00
|
|
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
2015-11-11 18:03:16 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Reload Nginx
|
2017-03-10 16:59:58 +01:00
|
|
|
sudo service nginx reload || true
|