aboutsummaryrefslogtreecommitdiff
path: root/net-im/jabberd/files/patch-tools__jabberd.in
blob: bb542fde0bf038f3343bd4cfd75c492fc62ce6e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--- tools/jabberd.in.orig	2016-02-09 09:45:54 UTC
+++ tools/jabberd.in
@@ -1,10 +1,5 @@
-#!/bin/sh
-#-*-Perl-*-
+#!/usr/local/bin/perl
 
-exec perl -w -x $0 "$@"
-
-#!perl
-
 ##############################################################################
 #
 # jabberd - perl wrapper script to manage launching and controlling the various
@@ -28,8 +23,7 @@ my $Bin = "@bindir@";
 my $LibExec = "@libexecdir@";
 my $VERSION = "@VERSION@";
 my $config_dir = "@sysconfdir@";
-my $config = $config_dir."/jabberd.cfg";
-$config = "internal" unless (-e $config);
+my $config = "jabberd.cfg";
 my $debug = 0;
 my $daemon = 0;
 my $g_kill_signal = "";
@@ -44,13 +38,20 @@ my @programs;
 # Process the command line arguments
 #-----------------------------------------------------------------------------
 my %opts;
-getopts("c:Dhb",\%opts);
+getopts("c:d:Dhb",\%opts);
 &usage if exists($opts{h});
 if (exists($opts{c}))
 {
     $config = $opts{c} if (defined($opts{c}) && ($opts{c} ne ""));
     &usage() if (!defined($opts{c}) || ($opts{c} eq ""));
 }
+if (exists($opts{d}))
+{
+    $config_dir = $opts{d} if (defined($opts{d}) && ($opts{d} ne ""));
+    &usage() if (!defined($opts{d}) || ($opts{d} eq ""));
+}
+$config = $config_dir.'/'.$config if ($config !~ /^\//);
+$config = "internal" unless (-e $config);
 
 $debug = 1 if exists($opts{D});
 $daemon = 1 if exists($opts{b});
@@ -120,6 +121,7 @@ if ($debug)
     &debug("jabberd","stdout","debug on\n");
     &debug("jabberd","stdout","version($VERSION)\n");
     &debug("jabberd","stdout","config_dir($config_dir)\n");
+    &debug("jabberd","stdout","config($config)\n");
 }
 
 #-----------------------------------------------------------------------------