install 987 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. app=ynhexample
  3. # Retrieve arguments
  4. domain=$1
  5. path=$2
  6. admin=$3
  7. is_public=$4
  8. # Save app settings
  9. sudo yunohost app setting $app admin -v "$admin"
  10. sudo yunohost app setting $app is_public -v "$is_public"
  11. # Check domain/path availability
  12. sudo yunohost app checkurl $domain$path -a $app
  13. if [[ ! $? -eq 0 ]]; then
  14. exit 1
  15. fi
  16. # Copy source files
  17. final_path=/var/www/$app
  18. sudo mkdir -p $final_path
  19. sudo cp -a ../sources/* $final_path
  20. # Modify Nginx configuration file and copy it to Nginx conf directory
  21. sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
  22. sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
  23. sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
  24. # If app is public, add url to SSOWat conf as skipped_uris
  25. if [ "$is_public" = "Yes" ];
  26. then
  27. # unprotected_uris allows SSO credentials to be passed anyway.
  28. sudo yunohost app setting $app unprotected_uris -v "/"
  29. fi
  30. # Restart services
  31. sudo service nginx reload
  32. sudo yunohost app ssowatconf