upgrade 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # Exit on command errors and treat unset variables as an error
  3. set -eu
  4. # See comments in install script
  5. app=$YNH_APP_INSTANCE_NAME
  6. # Source YunoHost helpers
  7. . /usr/share/yunohost/helpers
  8. # Retrieve app settings
  9. domain=$(ynh_app_setting_get "$app" domain)
  10. path=$(ynh_app_setting_get "$app" path)
  11. admin=$(ynh_app_setting_get "$app" admin)
  12. is_public=$(ynh_app_setting_get "$app" is_public)
  13. language=$(ynh_app_setting_get "$app" language)
  14. # Remove trailing "/" for next commands
  15. path=${path%/}
  16. # Copy source files
  17. src_path=/var/www/$app
  18. sudo mkdir -p $src_path
  19. sudo cp -a ../sources/. $src_path
  20. # Set permissions to app files
  21. # you may need to make some file and/or directory writeable by www-data (nginx user)
  22. sudo chown -R root: $src_path
  23. # Modify Nginx configuration file and copy it to Nginx conf directory
  24. nginx_conf=../conf/nginx.conf
  25. sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf
  26. sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf
  27. # If a dedicated php-fpm process is used:
  28. #
  29. # sed -i "s@YNH_WWW_APP@$app@g" $nginx_conf
  30. sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
  31. # If a dedicated php-fpm process is used:
  32. #
  33. # # Modify PHP-FPM pool configuration and copy it to the pool directory
  34. # sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf
  35. # sed -i "s@YNH_WWW_ALIAS@$src_path/@g" ../conf/php-fpm.conf
  36. # finalphpconf=/etc/php5/fpm/pool.d/$app.conf
  37. # sudo cp ../conf/php-fpm.conf $finalphpconf
  38. # sudo chown root: $finalphpconf
  39. # sudo chmod 644 $finalphpconf
  40. # If app is public, add url to SSOWat conf as skipped_uris
  41. if [[ $is_public -eq 1 ]]; then
  42. # See install script
  43. ynh_app_setting_set "$app" unprotected_uris "/"
  44. fi
  45. # If a dedicated php-fpm process is used:
  46. #
  47. # sudo service php5-fpm restart
  48. # Reload nginx service
  49. sudo service nginx reload