diff --git a/scripts/upgrade b/scripts/upgrade index 4547608..b6c6395 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -3,6 +3,8 @@ # Exit on command errors and treat unset variables as an error set -eu +source .functions + # See comments in install script app=$YNH_APP_INSTANCE_NAME @@ -16,8 +18,8 @@ admin=$(ynh_app_setting_get "$app" admin) is_public=$(ynh_app_setting_get "$app" is_public) language=$(ynh_app_setting_get "$app" language) -# Remove trailing "/" for next commands -path=${path%/} +# Check path and correct if required +CHECK_PATH # Copy source files src_path=/var/www/$app @@ -29,9 +31,17 @@ sudo cp -a ../sources/. $src_path sudo chown -R root: $src_path # Modify Nginx configuration file and copy it to Nginx conf directory +### Nginx ### +if [ $path = "/" ]; then +nginx_conf=../conf/nginx_root.conf +else nginx_conf=../conf/nginx.conf +fi sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf -sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf +sed -i "s@YNH_WWW_ALIAS@$app/@g" $nginx_conf +sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf +sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf + # If a dedicated php-fpm process is used: # sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf