my $basepath = "@BASE_DIR@";
my $confpath = "@CONFIG_DIR@/";
my $binpath = "@BINARY_DIR@";
-my $libpath = "@LIBRARY_DIR@";
my $valgrindlogpath = "$basepath/valgrindlogs";
my $executable = "@EXECUTABLE@";
my $version = "@VERSION@";
our($pid,$pidfile);
# Lets see what they want to do.. Set the variable (Cause i'm a lazy coder)
my $arg = shift(@ARGV);
-my $conf = $confpath . "inspircd.conf";
+my $conf;
for my $a (@ARGV)
{
if ($a =~ m/^--config=(.*)$/)
last;
}
}
+if (!defined $conf) {
+ $conf = $confpath . "inspircd.conf";
+ push @ARGV, '--config='.$conf;
+}
+
getpidfile($conf);
# System for naming script command subs:
{
# Set the PID file and return.
$pidfile = $1;
+ if (-f $pidfile)
+ {
+ return;
+ }
+ else
+ {
+ if (-f $confpath . $pidfile)
+ {
+ $pidfile = $confpath . $pidfile;
+ return;
+ }
+ }
return;
}
}
+
# If we get here, NO PID FILE! -- Check for includes
for my $i (@lines) {
$i =~ s/[^=]+=\s(.*)/\1/;
# Decend into that file, and check for PIDs.. (that sounds like an STD ;/)
getpidfile($1);
# Was a PID found?
+ if (-f $pidfile)
+ {
+ return;
+ }
+ else
+ {
+ if (-f $confpath . $pidfile)
+ {
+ $pidfile = $confpath . $pidfile;
+ return;
+ }
+ }
if ($pidfile ne "") {
# Yes, Return.
return;