summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2016-05-27 14:50:38 +0200
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2016-05-27 14:52:36 +0200
commit5739711991a412084e89905e2ebaf396ab8fb6b1 (patch)
tree2d86c2762740926066eeb5c9f937813e986acf76
parent2685d6e0ddeef51a5aafe6544e3aa6c1dfc5035e (diff)
downloadexim4-5739711991a412084e89905e2ebaf396ab8fb6b1.tar.gz
exipick: autodetect the spool directory from exim -bP
-rw-r--r--src/OS/Makefile-Base1
-rw-r--r--src/src/exipick.src13
2 files changed, 10 insertions, 4 deletions
diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base
index cba5cd359..3965ba36f 100644
--- a/src/OS/Makefile-Base
+++ b/src/OS/Makefile-Base
@@ -279,6 +279,7 @@ exipick: Makefile ../src/exipick.src
@rm -f exipick
@sed -e "s?PERL_COMMAND?$(PERL_COMMAND)?" \
-e "s?SPOOL_DIRECTORY?$(SPOOL_DIRECTORY)?" \
+ -e "s?BIN_DIRECTORY?$(BIN_DIRECTORY)?" \
../src/exipick.src > exipick-t
@mv exipick-t exipick
@chmod a+x exipick
diff --git a/src/src/exipick.src b/src/src/exipick.src
index 4708ebb4a..bdeba95fc 100644
--- a/src/src/exipick.src
+++ b/src/src/exipick.src
@@ -1,7 +1,9 @@
#!PERL_COMMAND
-# This variable should be set by the building process to Exim's spool directory.
-my $spool = 'SPOOL_DIRECTORY';
+# This variables should be set by the building process
+my $spool = 'SPOOL_DIRECTORY'; # may be overridden later
+my $exim = 'BIN_DIRECTORY/exim';
+
# Need to set this dynamically during build, but it's not used right now anyway.
my $charset = 'ISO-8859-1';
@@ -111,7 +113,9 @@ $G::and = $G::and; # shut up -w
$G::msg_ids = {}; # short circuit when crit is only MID
$G::caseless = $G::caseful ? 0 : 1; # nocase by default, case if both
@G::recipients_crit = (); # holds per-recip criteria
-$spool = $G::spool if ($G::spool);
+$spool = defined $G::spool ? $G::spool
+ : do { chomp($_ = `$exim -n -bP spool_directory`);
+ $_ // $spool };
my $input_dir = $G::input_dir || ($G::finput ? "Finput" : "input");
my $count_only = 1 if ($G::mailq_bpc || $G::qgrep_c);
my $unsorted = 1 if ($G::mailq_bpr || $G::mailq_bpra ||
@@ -1427,7 +1431,8 @@ Same as '$shown_message_size eq <string>' (exiqgrep)
=item --spool <path>
-Set the path to the exim spool to use. This value will have the argument to --input or 'input' appended, or be ignored if --input is a full path.
+Set the path to the exim spool to use. This value will have the argument to --input or 'input' appended, or be ignored if --input is a full path. If not specified, exipick uses the value from C<exim -bP spool_directory>, and if this fails, the F<SPOOL_DIRECTORY>
+from build time (F<Local/Makefile>) is used.
=item --show-rules