Created
August 4, 2014 22:08
-
-
Save eyemagine2/b46a640c8625f6538315 to your computer and use it in GitHub Desktop.
Configure new eyemagine repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function getRepoName() { | |
echo "Enter the name of the repository to configure (all lowercase, one word)..." | |
read repo | |
if [ -z "$repo" ]; then | |
echo "Repository name cannot be empty" | |
getRepoName | |
fi | |
repodir="/home/git/repositories/$repo.git" | |
if [ ! -d "$repodir" ]; then | |
echo "Repository directory does not exist ($repodir). Please try again" | |
getRepoName | |
fi | |
} | |
function getRepoDesc() { | |
echo "Enter the full, readable name of the repository (Melton Tackle, Braven)..." | |
read repodesc | |
if [ -z "$repodesc" ]; then | |
echo "Repository full name cannot be empty" | |
getRepoDesc | |
fi | |
} | |
function getRepoContacts() { | |
echo "Enter a comma separated list of contact emails for the hook events ([email protected],[email protected])" | |
read emails | |
} | |
# Fetch all required parameters | |
getRepoName | |
getRepoDesc | |
getRepoContacts | |
# Create description | |
echo "$repodesc Repository on GT:" > "$repodir/description" | |
echo "Description added at $repodir/description..." | |
# Add hook variables | |
echo "[hooks] | |
mailinglist = \"$emails\" | |
senderemail = \"[email protected]\" | |
emailprefix = \"[git repo]: \" | |
showrev = \"git show -C %s; echo\"" >> "$repodir/config" | |
echo "Hooks configured at $repodir/config..." | |
# Symlink post-receive | |
ln -s /usr/share/git-core/contrib/hooks/post-receive-email "$repodir/hooks/post-receive" | |
echo "post-receive hook created at $repodir/hooks/post-receive..." | |
echo "Repository configuration complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment