Created
August 27, 2015 15:41
-
-
Save futuro/b2b6ecde59c61c2ba311 to your computer and use it in GitHub Desktop.
Post-merge hook which fixes perms inside the puppet directory. This was a work-around for the fact that I had to clone puppet repos as root, but they had to run as the puppet user.
This file contains 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 | |
# Get some helper functions | |
. git-sh-setup | |
# Go to the toplevel of the git directory | |
cd_to_toplevel | |
# If we're in the puppet modules, run the following, since they're specific to puppet | |
if [[ "$PWD" == "/etc/puppet/environments/production/modules"* ]] | |
then | |
# Fix the owner | |
chown -R puppet:puppet . | |
# Change the files perms to 644 and the directory perms to 755, skipping the .git directory | |
find . -path ./.git -prune -o \ | |
\( -type f -exec chmod 644 {} \; \) ,\ | |
\( -type d -exec chmod 755 {} \; \) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment