Skip to content

Commit

Permalink
Allow recursion into {pre,post}-up hook directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Olmos de Aguilera Corradini committed Sep 15, 2013
1 parent 4a6f937 commit 9187047
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions share/rcm.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,22 @@ run_hooks() {
$DEBUG " with DOTFILES_DIRS: $DOTFILES_DIRS"
local when=$1
local direction=$2
local hook_file="$dotfiles_dir/hooks/$when-$direction"

if [ $RUN_HOOKS -eq 1 ]; then
for dotfiles_dir in $DOTFILES_DIRS; do
$DEBUG "hook: $dotfiles_dir/hooks/$when-$direction"
if [ -x "$dotfiles_dir/hooks/$when-$direction" ]; then
if [ -f $hook_file ] && [ -x $hook_file ]; then
$VERBOSE "running $when-$direction hooks for $dotfiles_dir"
$dotfiles_dir/hooks/$when-$direction
$hook_file
elif [ -d $hook_file ]; then
$VERBOSE "running $when-$direction hooks for $dotfiles_dir"
for hook in $hook_file/*; do
if [ -x "$hook" ]; then
$VERBOSE "running $when-$direction `basename $hook`"
$hook
fi
done
fi
done
fi
Expand Down

0 comments on commit 9187047

Please sign in to comment.