upgrade 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. final_path=/var/www/$app
  18. sudo mkdir -p $final_path
  19. sudo cp -a ../sources/. $final_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:root $final_path
  23. # Modify Nginx configuration file and copy it to Nginx conf directory
  24. sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
  25. sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
  26. # If a dedicated php-fpm process is used:
  27. #
  28. # sudo sed -i "s@YNH_WWW_APP@$app@g" ../conf/nginx.conf
  29. sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
  30. # If a dedicated php-fpm process is used:
  31. #
  32. # # Modify PHP-FPM pool configuration and copy it to the pool directory
  33. # sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf
  34. # sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/php-fpm.conf
  35. # finalphpconf=/etc/php5/fpm/pool.d/$app.conf
  36. # sudo cp ../conf/php-fpm.conf $finalphpconf
  37. # sudo chown root: $finalphpconf
  38. # sudo chmod 644 $finalphpconf
  39. # If app is public, add url to SSOWat conf as skipped_uris
  40. if [[ $is_public -eq 1 ]];
  41. then
  42. # See install script
  43. ynh_app_setting_set "$app" unprotected_uris "/"
  44. # Remove old settings
  45. ynh_app_setting_delete "$app" skipped_uris
  46. fi
  47. # If a dedicated php-fpm process is used:
  48. #
  49. # sudo service php5-fpm restart
  50. # Restart services
  51. sudo service nginx reload