summaryrefslogtreecommitdiff
path: root/share/rcm.sh.in
diff options
context:
space:
mode:
authorGravatar Pablo Olmos de Aguilera Corradini <pablo@glatelier.org>2014-02-18 00:40:47 -0200
committerGravatar Mike Burns <mike@mike-burns.com>2014-02-24 15:38:00 +0100
commita5bb6d59b77785efa57b226a0cb45ff07390af6b (patch)
treebce3976afacb20294ad74205ccd18bc35eed85f2 /share/rcm.sh.in
parent04b627fe5ed97c66648995176481a0485200ac8d (diff)
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.
Diffstat (limited to 'share/rcm.sh.in')
-rw-r--r--share/rcm.sh.in7
1 files changed, 6 insertions, 1 deletions
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
}