Skip to content

Instantly share code, notes, and snippets.

@futuro
Created August 27, 2015 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save futuro/b2b6ecde59c61c2ba311 to your computer and use it in GitHub Desktop.
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.
#!/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