upgrade 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. source /usr/share/yunohost/helpers
  8. # Retrieve app settings
  9. domain=$(ynh_app_setting_get "$app" domain)
  10. path_url=$(ynh_app_setting_get "$app" path_url)
  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_url=${path_url%/}
  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_url@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. ### PHP (remove if not used) ###
  32. # If a dedicated php-fpm process is used:
  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. # sudo service php5-fpm restart
  41. ### PHP end ###
  42. # If app is public, add url to SSOWat conf as skipped_uris
  43. if [[ $is_public -eq 1 ]]; then
  44. # See install script
  45. ynh_app_setting_set "$app" unprotected_uris "/"
  46. fi
  47. # Reload nginx service
  48. sudo service nginx reload