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