[pkg-haskell-tools] 01/03: Export DHT_SCRIPT_DIR to scripts
Joachim Breitner
nomeata at moszumanska.debian.org
Thu Aug 13 10:03:26 UTC 2015
This is an automated email from the git hooks/post-receive script.
nomeata pushed a commit to branch master
in repository pkg-haskell-tools.
commit 01b31119b4bfe07f316b163857c819c1ae4be464
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Thu Aug 13 11:30:31 2015 +0200
Export DHT_SCRIPT_DIR to scripts
---
dht | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/dht b/dht
index a60d853..5f7939b 100755
--- a/dht
+++ b/dht
@@ -8,18 +8,20 @@ no warnings 'experimental::smartmatch';
use File::Basename;
-our $SCRIPT_DIR;
+our $DHT_SCRIPT_DIR;
if (__FILE__ eq "/usr/bin/dht") {
- $SCRIPT_DIR="/var/lib/pkg-haskell-tools";
+ $DHT_SCRIPT_DIR="/var/lib/pkg-haskell-tools";
} else {
- $SCRIPT_DIR=dirname(__FILE__)."/scripts";
+ $DHT_SCRIPT_DIR=dirname(__FILE__)."/scripts";
}
-our @SCRIPTS = ();
-opendir(DIR, $SCRIPT_DIR) or die $!;
+$ENV{DHT_SCRIPT_DIR} = $DHT_SCRIPT_DIR;
+
+our @DHT_SCRIPT_DIR = ();
+opendir(DIR, $DHT_SCRIPT_DIR) or die $!;
while (my $file = readdir(DIR)) {
next if ($file =~ m/^\./);
- push @SCRIPTS, $file;
+ push @DHT_SCRIPT_DIR, $file;
}
closedir(DIR);
@@ -35,9 +37,9 @@ less useful tools.
Supported subcommands:
__END__
- for my $script (@SCRIPTS) {
+ for my $script (@DHT_SCRIPT_DIR) {
# print first line of help
- open (HELP, '-|', "$SCRIPT_DIR/$script", "--help") or die $!;
+ open (HELP, '-|', "$DHT_SCRIPT_DIR/$script", "--help") or die $!;
print " " . scalar(<HELP>);
close HELP;
}
@@ -53,11 +55,11 @@ if (not @ARGV or $ARGV[0] eq "--version" ) {
}
my $cmd = shift @ARGV;
-unless ($cmd ~~ @SCRIPTS) {
+unless ($cmd ~~ @DHT_SCRIPT_DIR) {
print "Subcommand $cmd not known.\n";
print "Run $0 to see a list of supported commands.\n";
exit(1)
}
-exec "$SCRIPT_DIR/$cmd", at ARGV;
+exec "$DHT_SCRIPT_DIR/$cmd", at ARGV;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/pkg-haskell-tools.git
More information about the Pkg-haskell-commits
mailing list