Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. echo "Welcome to the DSB project set up script."
  2. echo "This script will set up a basic project structure, bare git repository, and password protection."
  3. echo "Please enter the name for the project. This will also be the htaccess username:"
  4.  
  5. # Get the project name - this will be used in the folder path and in the htacess username
  6. read name
  7.  
  8. # Echo verbose commands
  9. set -x
  10.  
  11. # Create the repo directory
  12. mkdir -p ~/Development/$name/$name.git
  13. cd ~/Development/$name
  14.  
  15. # Create a basic index file
  16. echo "This is the index for:" $name > index.html
  17. cd $name.git
  18.  
  19. # Run git init and set up git hooks in the directory
  20. git init --bare
  21. cat > hooks/post-receive << EOF
  22. #!/bin/sh
  23. GIT_WORK_TREE=~/public_html/client/$name git checkout -f
  24. EOF
  25. chmod +x hooks/post-receive
  26.  
  27. set +x
  28.  
  29. echo "Git post receive hook is set up at $name/$name.git"
  30.  
  31. # Start htaccess setup
  32. cd ~/Development/$name
  33. echo "Begin setting up htaccess. Enter htpassword below"
  34.  
  35. # Create htpasswd file
  36. htpasswd -c .htpasswd $name
  37.  
  38. # Create htaccess file
  39. echo "Setting up htaccess file..."
  40.  
  41. {
  42. echo 'AuthUserFile /home/darksquarebishop/public_html/client/'$name'/.htpasswd'
  43. echo 'AuthName "Please Log In"'
  44. echo 'AuthType Basic'
  45. echo 'require user' $name
  46. } > .htaccess
  47.  
  48. echo "Copying files to server..."
  49.  
  50. # Copy folder and files to server
  51. scp -r ~/Development/$name darksquarebishop@darksquarebishop.com:~/public_html/client/$name
  52.  
  53. # Delete local files
  54.  
  55. echo "Cleaning up..."
  56.  
  57. rm -r ~/Development/$name
  58.  
  59. echo "All done!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement