[Xfce4-commits] <xfce-git-hooks:master> find the .functions file in the same dir as the script, wherever it is

Brian J. Tarricone brian at tarricone.org
Wed Aug 12 21:28:07 CEST 2009


Updating branch refs/heads/master
         to 41ba219865154773c17828d35eb46f242536adf1 (commit)
       from 70f2af8408446d40f1e64372a718c98acab9e1c2 (commit)

commit 41ba219865154773c17828d35eb46f242536adf1
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Mon Aug 10 15:27:12 2009 -0700

    find the .functions file in the same dir as the script, wherever it is

 hooks/update-03-send-commit-mails   |    8 ++++++--
 hooks/xfce-git-mail-queue.functions |    2 +-
 hooks/xfce-process-git-mail-queue   |    8 ++++++--
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/hooks/update-03-send-commit-mails b/hooks/update-03-send-commit-mails
index 931a99b..bb14102 100755
--- a/hooks/update-03-send-commit-mails
+++ b/hooks/update-03-send-commit-mails
@@ -19,8 +19,12 @@
 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-# FIXME: hardcoded path
-. xfce-git-mail-queue.functions
+if echo $0 | grep -q '^/'; then
+  mydir=`dirname $0`
+else
+  mydir=`pwd`/`dirname $0`
+fi
+. "$mydir/xfce-git-mail-queue.functions"
 
 DATEFORMAT="%F %R %z"
 MAIL_QUEUE_DIR=/var/spool/git-mail
diff --git a/hooks/xfce-git-mail-queue.functions b/hooks/xfce-git-mail-queue.functions
index 27b2a34..29f8460 100755
--- a/hooks/xfce-git-mail-queue.functions
+++ b/hooks/xfce-git-mail-queue.functions
@@ -10,7 +10,7 @@ lock_queue_directory()
   # about as long as it would take to process the queue at 1 mail
   # per second.
   waittime=`ls -1 "$MAIL_QUEUE_DIR" | wc -l`
-  waittime=`$waittime + 10`  # some wiggle room
+  waittime=`expr $waittime + 10`  # some wiggle room
   
   while ! mkdir $lockfile 2>/dev/null && [ $waittime -ge 0 ]; do
     sleep 1
diff --git a/hooks/xfce-process-git-mail-queue b/hooks/xfce-process-git-mail-queue
index f24a72c..88e7e75 100755
--- a/hooks/xfce-process-git-mail-queue
+++ b/hooks/xfce-process-git-mail-queue
@@ -1,7 +1,11 @@
 #!/bin/sh
 
-# FIXME: hardcoded path
-. xfce-git-mail-queue.functions
+if echo $0 | grep -q '^/'; then
+  mydir=`dirname $0`
+else
+  mydir=`pwd`/`dirname $0`
+fi
+. "$mydir/xfce-git-mail-queue.functions"
 
 lock_queue_directory
 



More information about the Xfce4-commits mailing list