auto.pid saves to the correct location and CertFP works.

This commit is contained in:
Elijah Perrault committed 2011-03-11 21:53:04 -07:00
1 parent 881fc0d93d
commit 8e1ce1476e
2 files changed
+20 -5

No files matched your search

+16 -2
View File
@@ -19,7 +19,7 @@ use DBI;
use Class::Unload;
use FindBin qw($Bin);
our $Bin = $Bin; ## no critic qw(NamingConventions::Capitalization Variables::ProhibitPackageVars)
our %bin;
our (%bin, $UPREFIX);
BEGIN {
$bin{cwd} = getcwd;
if (!-e "$Bin/../build/syswide") {
@@ -38,6 +38,7 @@ BEGIN {
$bin{bld} = "$Bin/../build";
$bin{lng} = "$Bin/../lang";
}
$UPREFIX = 1;
}
else {
# Must be a standard install.
@@ -46,6 +47,7 @@ BEGIN {
$bin{lib} = "$Bin/../lib";
$bin{bld} = "$Bin/../build";
$bin{lng} = "$Bin/../lang";
$UPREFIX = 0;
}
unshift @INC, $bin{lib};
@@ -119,6 +121,14 @@ if ($BFVER[0] ne VER.q{.}.SVER.q{.}.REV.RSTAGE."\n") {
}
undef @BFVER;
# Check build path setup.
our $SYSWIDE;
open my $BFPATH, '<', "$bin{bld}/syswide" or say 'Cannot start: Broken build.' and exit;
my @BFPATH = <$BFPATH>;
close $BFPATH or say 'Cannot start: Broken build.' and exit;
if ($BFPATH[0] eq "1\n") { $SYSWIDE = 1 }
else { $SYSWIDE = 0 }
# Set signal handlers.
local $SIG{TERM} = \&Lib::Auto::signal_term;
local $SIG{INT} = \&Lib::Auto::signal_int;
@@ -405,7 +415,11 @@ if (!$DEBUG) {
$APID = fork;
if ($APID != 0) {
alog '* Successfully forked into the background. Process ID: '.$APID;
open my $FPID, '>', "$Bin/auto.pid" or exit;
# Figure out where to throw auto.pid.
my $pidfile;
if ($UPREFIX) { $pidfile = "$bin{cwd}/auto.pid" }
else { $pidfile = "$Bin/auto.pid" }
open my $FPID, '>', $pidfile or exit;
print {$FPID} "$APID\n" or exit;
close $FPID or exit;
exit;
+4 -3
View File
@@ -183,10 +183,10 @@ sub ircsock {
if ($cdata->{'certfp'}[0] eq 1) {
$conndata{'SSL_use_cert'} = 1;
if (defined $cdata->{'certfp_cert'}[0]) {
$conndata{'SSL_cert_file'} = "$Auto::Bin/../etc/certs/".$cdata->{'certfp_cert'}[0];
$conndata{'SSL_cert_file'} = "$Auto::bin{etc}/certs/".$cdata->{'certfp_cert'}[0];
}
if (defined $cdata->{'certfp_key'}[0]) {
$conndata{'SSL_key_file'} = "$Auto::Bin/../etc/certs/".$cdata->{'certfp_key'}[0];
$conndata{'SSL_key_file'} = "$Auto::bin{etc}/certs/".$cdata->{'certfp_key'}[0];
}
if (defined $cdata->{'certfp_pass'}[0]) {
$conndata{'SSL_passwd_cb'} = sub { return $cdata->{'certfp_pass'}[0]; };
@@ -239,7 +239,8 @@ sub ircsock {
# Shutdown.
hook_add('on_shutdown', 'shutdown.core_cleanup', sub {
if (defined $Auto::DB) { $Auto::DB->disconnect; }
if (-e "$Auto::Bin/auto.pid") { unlink "$Auto::Bin/auto.pid"; }
if ($Auto::UPREFIX) { if (-e "$Auto::bin{cwd}/auto.pid") { unlink "$Auto::bin{cwd}/auto.pid"; } }
else { if (-e "$Auto::Bin/auto.pid") { unlink "$Auto::Bin/auto.pid"; } }
return 1;
});