-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathircd
executable file
·22 lines (22 loc) · 1.06 KB
/
ircd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/perl
# Copyright (c) 2010-17, Mitchell Cooper
use warnings; use strict; use 5.010;
foreach ([qw(__WARN__ WARNING)], [qw(TERM terminate )], [qw(KILL terminate)],
[qw(INT terminate)], [qw(PIPE signalpipe)], [qw(HUP signalhup)]) {
my ($sig, $func) = @$_; $SIG{$sig} = sub { safe_call($func, @_) } }
our ($run_dir, $loop, $api, $pool, %v); local $0 = 'juno';
BEGIN {
defined($run_dir = shift @ARGV) or die "No directory specified";
die "Run directory does not exist" unless -d $run_dir;
chdir $run_dir or die "Can't access run directory";
foreach ($run_dir, map { "$run_dir/lib$_" } ('', qw(/evented-object/lib
/evented-api-engine/lib))) { unshift @INC, $_ }
require Evented::API::Engine;
}
sub get_version { $_ = $api->_slurp('ircd', "$run_dir/VERSION"); chomp; $_ }
sub safe_call { my $f = shift; (ircd->can($f) or return)->(@_) }
$api = Evented::API::Engine->new(
mod_inc => ['modules', 'lib/evented-api-engine/mod']);
our $VERSION = get_version() or die "Can't read VERSION";
$api->load_module('ircd') or exit 1;
ircd::loop();