[Pm-utils] [PATCH 12/12] Optionally ignore two leading digits in the hook filename in hook_ok

Victor Lowther victor.lowther at gmail.com
Tue Mar 11 18:08:58 PDT 2008


Requested by Michael Biebl.
---
 pm/pm-functions.in |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/pm/pm-functions.in b/pm/pm-functions.in
index 120bc33..0adfb6a 100644
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -91,7 +91,11 @@ hook_exit_status(){
 
 hook_ok()
 {
-	[ -f "$STORAGEDIR/disable_hook:${1##*/}" ] && return $DX
+	local hook="${1##*/}"
+	## the actual name as passed to us.
+	[ -f "$STORAGEDIR/disable_hook:$hook" ] && return $DX
+	## name with zeros chopped off the filename
+	[ -f "$STORAGEDIR/disable_hook:${hook#[0-9][0-9]}" ] && return $DX
 	[ -x "$1" ] || return $NX
 	return 0
 }
-- 
1.5.4.3



More information about the Pm-utils mailing list