commit:     5b39452838f97dd3645fb102a8f784639209ef1b
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Mar 31 15:37:15 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Mar 31 15:37:15 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=5b394528

hooks: use die_cannot_run()

---
 files/hooks/create-metadata-cache.sh | 4 ++--
 files/hooks/git-commit-overlay.sh    | 2 +-
 files/hooks/git-push.sh              | 2 ++
 files/hooks/notify-desktop.sh        | 2 ++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/files/hooks/create-metadata-cache.sh 
b/files/hooks/create-metadata-cache.sh
index 808f537..a406d7f 100644
--- a/files/hooks/create-metadata-cache.sh
+++ b/files/hooks/create-metadata-cache.sh
@@ -14,10 +14,10 @@ set -u
 #$lf ...
 
 : ${EGENCACHE:=egencache}
-#autodie qwhich "${EGENCACHE}"
+qwhich "${EGENCACHE}" || die_cannot_run "egencache is not available."
 
 # a valid PORTDIR is required
-[ -d "${PORTDIR-}" ] || die "\$PORTDIR '${PORTDIR-}' does not exist."
+[ -d "${PORTDIR-}" ] || die_cannot_run "\$PORTDIR '${PORTDIR-}' does not 
exist."
 
 # void cleanup()
 #

diff --git a/files/hooks/git-commit-overlay.sh 
b/files/hooks/git-commit-overlay.sh
index 2e726fb..30aad1c 100644
--- a/files/hooks/git-commit-overlay.sh
+++ b/files/hooks/git-commit-overlay.sh
@@ -17,7 +17,7 @@ set -u
 
 ## load git helper functions
 $lf git
-#autodie qwhich ${GIT}
+qwhich "${GIT}" || die_cannot_run "git is not available."
 
 
 ## functions

diff --git a/files/hooks/git-push.sh b/files/hooks/git-push.sh
index 7d79e64..d5a410a 100644
--- a/files/hooks/git-push.sh
+++ b/files/hooks/git-push.sh
@@ -13,6 +13,8 @@ set -u
 # using line_iterator() from itertools
 $lf git itertools
 
+qwhich "${GIT}" || die_cannot_run "git is not available."
+
 
 ## functions
 

diff --git a/files/hooks/notify-desktop.sh b/files/hooks/notify-desktop.sh
index 9184c2f..32ae230 100644
--- a/files/hooks/notify-desktop.sh
+++ b/files/hooks/notify-desktop.sh
@@ -9,6 +9,8 @@ set -u
 . "${FUNCTIONS?}" || exit
 #dont_run_as_root
 
+qwhich notify-send || die_cannot_run "notify-send is not available."
+
 ## load helper functions
 #$lf ...
 

Reply via email to