[PATCH] email: fix switch to dash check

Jacob Keller jacob.e.keller at intel.com
Tue Mar 18 15:56:12 PDT 2014


This patch fixes the switch to dash check for email scripts, by using
prgdir instead of srcdir. We default srcdir to be the base directory,
instead of the directory in which the program lives. This causes issues
because when dash is available, it will try to run the aiaiai-email-*
scripts from inside the srcdir, instead of the srcdir/email directory.

Signed-off-by: Jacob Keller <jacob.e.keller at intel.com>
---
 email/aiaiai-email-dispatcher        | 3 ++-
 email/aiaiai-email-dispatcher-helper | 3 ++-
 email/aiaiai-email-lda               | 3 ++-
 email/aiaiai-email-test-patchset     | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/email/aiaiai-email-dispatcher b/email/aiaiai-email-dispatcher
index d31e88ebb226..fda887a0f017 100755
--- a/email/aiaiai-email-dispatcher
+++ b/email/aiaiai-email-dispatcher
@@ -4,6 +4,7 @@
 # Author: Artem Bityutskiy
 # License: GPLv2
 
+prgdir="$(readlink -ev -- ${0%/*})"
 srcdir="$(readlink -ev -- ${0%/*}/..)"
 PATH="$srcdir/helpers:$srcdir/email:$srcdir/helpers/libshell:$PATH"
 
@@ -20,7 +21,7 @@ message_time="yes"
 # This is a small trick to make sure the script is portable - check if 'dash'
 # is present, and if yes - use it.
 if can_switch_to_dash; then
-	exec dash -euf -- "$srcdir/$PROG" "$@"
+	exec dash -euf -- "$prgdir/$PROG" "$@"
 	exit $?
 fi
 
diff --git a/email/aiaiai-email-dispatcher-helper b/email/aiaiai-email-dispatcher-helper
index 018c0d4cdc9b..1995b06a46af 100755
--- a/email/aiaiai-email-dispatcher-helper
+++ b/email/aiaiai-email-dispatcher-helper
@@ -4,6 +4,7 @@
 # Author: Artem Bityutskiy
 # License: GPLv2
 
+prgdir="$(readlink -ev -- ${0%/*})"
 srcdir="$(readlink -ev -- ${0%/*}/..)"
 PATH="$srcdir/helpers:$srcdir/email:$srcdir/libshell:$PATH"
 
@@ -17,7 +18,7 @@ message_time="yes"
 # This is a small trick to make sure the script is portable - check if 'dash'
 # is present, and if yes - use it.
 if can_switch_to_dash; then
-	exec dash -euf -- "$srcdir/$PROG" "$@"
+	exec dash -euf -- "$prgdir/$PROG" "$@"
 	exit $?
 fi
 
diff --git a/email/aiaiai-email-lda b/email/aiaiai-email-lda
index 5db3f15e9918..06134b06d166 100755
--- a/email/aiaiai-email-lda
+++ b/email/aiaiai-email-lda
@@ -4,6 +4,7 @@
 # Author: Artem Bityutskiy
 # License: GPLv2
 
+prgdir="$(readlink -ev -- ${0%/*})"
 srcdir="$(readlink -ev -- ${0%/*}/..)"
 PATH="$srcdir/helpers:$srcdir/email:$srcdir/helpers/libshell:$PATH"
 
@@ -19,7 +20,7 @@ message_time="yes"
 # This is a small trick to make sure the script is portable - check if 'dash'
 # is present, and if yes - use it.
 if can_switch_to_dash; then
-	exec dash -euf -- "$srcdir/$PROG" "$@"
+	exec dash -euf -- "$prgdir/$PROG" "$@"
 	exit $?
 fi
 
diff --git a/email/aiaiai-email-test-patchset b/email/aiaiai-email-test-patchset
index 3a7eb77d0b2b..4314f67d2316 100755
--- a/email/aiaiai-email-test-patchset
+++ b/email/aiaiai-email-test-patchset
@@ -4,6 +4,7 @@
 # Author: Artem Bityutskiy
 # License: GPLv2
 
+prgdir="$(readlink -ev -- ${0%/*})"
 srcdir="$(readlink -ev -- ${0%/*}/..)"
 PATH="$srcdir:$srcdir/helpers:$srcdir/email:$srcdir/helpers/libshell:$PATH"
 
@@ -19,7 +20,7 @@ export message_time="yes"
 # This is a small trick to make sure the script is portable - check if 'dash'
 # is present, and if yes - use it.
 if can_switch_to_dash; then
-	exec dash -euf -- "$srcdir/$PROG" "$@"
+	exec dash -euf -- "$prgdir/$PROG" "$@"
 	exit $?
 fi
 
-- 
1.8.3.1




More information about the aiaiai mailing list