upgrade 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # Exit on command errors and treat unset variables as an error
  3. set -eu
  4. source .fonctions # Loads the generic functions usually used in the script
  5. source /usr/share/yunohost/helpers # Source YunoHost helpers
  6. # See comments in install script
  7. app=$YNH_APP_INSTANCE_NAME
  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. CHECK_PATH # Checks and corrects the syntax of the path.
  15. root_pwd=$(sudo cat /etc/yunohost/mysql)
  16. final_path=/var/www/$app
  17. # Get source
  18. SETUP_SOURCE
  19. # Delete install directory after upgrade
  20. rm -fr "$final_path/install"
  21. db_name=$app
  22. # Modify Nginx configuration file and copy it to Nginx conf directory
  23. sudo sed -i "s@__PATHTOCHANGE__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
  24. sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/nginx/conf.d/$domain.d/$app.conf
  25. sudo sed -i "s@__NAMETOCHANGE__@$app@g" /etc/nginx/conf.d/$domain.d/$app.conf
  26. if [ "$is_public" = "Yes" ];
  27. then
  28. sudo sed -i "s@#--PRIVATE--@@g" /etc/nginx/conf.d/$domain.d/$app.conf
  29. fi
  30. # Create the php-fpm pool config
  31. POOL_FPM
  32. # Setup SSOwat
  33. ynh_app_setting_set "$app" is_public "$is_public"
  34. if [ "$is_public" = "Yes" ];
  35. then
  36. ynh_app_setting_set "$app" unprotected_uris "/"
  37. fi
  38. # Reload services
  39. sudo systemctl reload php5-fpm
  40. sudo systemctl reload nginx
  41. sudo yunohost app ssowatconf