upgrade 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. # causes the shell to exit if any subcommand or pipeline returns a non-zero status
  3. set -e
  4. # See comments in install script
  5. app=$YNH_APP_INSTANCE_NAME
  6. # Retrieve arguments
  7. domain=$(sudo yunohost app setting $app domain)
  8. path=$(sudo yunohost app setting $app path)
  9. admin=$(sudo yunohost app setting $app admin)
  10. is_public=$(sudo yunohost app setting $app is_public)
  11. language=$(sudo yunohost app setting $app language)
  12. # Remove trailing "/" for next commands
  13. path=${path%/}
  14. # Copy source files
  15. final_path=/var/www/$app
  16. sudo mkdir -p $final_path
  17. sudo cp -a ../sources/. $final_path
  18. # Set permissions to app files
  19. # you may need to make some file and/or directory writeable by www-data (nginx user)
  20. sudo chown -R root:root $final_path
  21. # Modify Nginx configuration file and copy it to Nginx conf directory
  22. sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
  23. sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
  24. # If a dedicated php-fpm process is used :
  25. #
  26. #sudo sed -i "s@YNH_WWW_APP@$app@g" ../conf/nginx.conf
  27. sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
  28. # If a dedicated php-fpm process is used :
  29. # Adjustment and copy dedicated php-fpm conf file
  30. #
  31. #sed -i "s@YNH_WWW_APP@$app@g" ../conf/php-fpm.conf
  32. #sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/php-fpm.conf
  33. #finalphpconf=/etc/php5/fpm/pool.d/$app.conf
  34. #sudo cp ../conf/php-fpm.conf $finalphpconf
  35. #sudo chown root: $finalphpconf
  36. #sudo chmod 644 $finalphpconf
  37. # If app is public, add url to SSOWat conf as skipped_uris
  38. if [[ $is_public -eq 1 ]];
  39. then
  40. # See install script
  41. sudo yunohost app setting $app unprotected_uris -v "/"
  42. # Remove old settings
  43. sudo yunohost app setting $app skipped_uris -d
  44. fi
  45. # If a dedicated php-fpm process is used :
  46. #
  47. #sudo service php5-fpm restart
  48. # Restart services
  49. sudo service nginx reload