Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo "Welcome to the DSB project set up script."
- echo "This script will set up a basic project structure, bare git repository, and password protection."
- echo "Please enter the name for the project. This will also be the htaccess username:"
- # Get the project name - this will be used in the folder path and in the htacess username
- read name
- # Echo verbose commands
- set -x
- # Create the repo directory
- mkdir -p ~/Development/$name/$name.git
- cd ~/Development/$name
- # Create a basic index file
- echo "This is the index for:" $name > index.html
- cd $name.git
- # Run git init and set up git hooks in the directory
- git init --bare
- cat > hooks/post-receive << EOF
- #!/bin/sh
- GIT_WORK_TREE=~/public_html/client/$name git checkout -f
- EOF
- chmod +x hooks/post-receive
- set +x
- echo "Git post receive hook is set up at $name/$name.git"
- # Start htaccess setup
- cd ~/Development/$name
- echo "Begin setting up htaccess. Enter htpassword below"
- # Create htpasswd file
- htpasswd -c .htpasswd $name
- # Create htaccess file
- echo "Setting up htaccess file..."
- {
- echo 'AuthUserFile /home/darksquarebishop/public_html/client/'$name'/.htpasswd'
- echo 'AuthName "Please Log In"'
- echo 'AuthType Basic'
- echo 'require user' $name
- } > .htaccess
- echo "Copying files to server..."
- # Copy folder and files to server
- scp -r ~/Development/$name darksquarebishop@darksquarebishop.com:~/public_html/client/$name
- # Delete local files
- echo "Cleaning up..."
- rm -r ~/Development/$name
- echo "All done!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement