From a5bb6d59b77785efa57b226a0cb45ff07390af6b Mon Sep 17 00:00:00 2001 From: Pablo Olmos de Aguilera Corradini Date: Tue, 18 Feb 2014 00:40:47 -0200 Subject: Fix error when hooks files/dirs don't exist We had been relying on `hooks/pre-up` and `hooks/post-up` files to exist. This explicitly checks first. Fixes #34. --- share/rcm.sh.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'share/rcm.sh.in') diff --git a/share/rcm.sh.in b/share/rcm.sh.in index 3260cd4..f6deccd 100644 --- a/share/rcm.sh.in +++ b/share/rcm.sh.in @@ -109,10 +109,15 @@ run_hooks() { local direction=$2 local hook_file="$dotfiles_dir/hooks/$when-$direction" + if [ ! -e "$hook_file" ]; then + $DEBUG "no $when-$direction hook file, skipping" + return 1 + fi + if [ $RUN_HOOKS -eq 1 ]; then for dotfiles_dir in $DOTFILES_DIRS; do $VERBOSE "running $when-$direction hooks for $dotfiles_dir" - find "$dotfiles_dir/hooks/$when-$direction" -type f -perm +111 -print -exec {} \; + find "$hook_file" -type f -perm +111 -print -exec {} \; done fi } -- cgit v1.2.3