install 922 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 dokuwiki
  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. sudo yunohost app setting $app skipped_uris -v "/"
  28. fi
  29. # Restart services
  30. sudo service nginx reload
  31. sudo yunohost app ssowatconf