summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2014-12-28 10:59:54 +0000
committerSami Kerola <kerolasa@iki.fi>2014-12-28 11:12:09 +0000
commitbbefd4b1076a7f2ea3c2d833ccbda9b7a441b318 (patch)
tree1058033cc83525a295fbb7b4aafb52037299b8b3
parentdf30334c1183b643e3821e81022ed774cd983f56 (diff)
scripts: check files exist before comparing
* bootstrap.conf: Add if clause before cmp(1) call.
-rw-r--r--bootstrap.conf8
1 files changed, 5 insertions, 3 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index 4e0b388..072e74d 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -109,9 +109,11 @@ bootstrap_epilogue()
if test $backup = 1; then
hooks=$(cd scripts/git-hooks && git ls-files)
for f in $hooks; do
- # If it is identical, skip it.
- cmp scripts/git-hooks/$f .git/hooks/$f > /dev/null \
- && continue
+ if [ -f .git/hooks/$f ]; then
+ # If it is identical, skip it.
+ cmp scripts/git-hooks/$f .git/hooks/$f > /dev/null \
+ && continue
+ fi
cp --backup=numbered scripts/git-hooks/$f .git/hooks
chmod a-w .git/hooks/$f
done