/
bric_ftpd
executable file
·52 lines (41 loc) · 1.03 KB
/
bric_ftpd
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
#!/usr/bin/perl -w
use strict;
BEGIN {
$ENV{BRICOLAGE_ROOT} ||= '/usr/local/bricolage';
eval { require Bric };
if ($@) {
# We need to set PERL5LIB.
require File::Spec::Functions;
my $lib = File::Spec::Functions::catdir($ENV{BRICOLAGE_ROOT}, 'lib');
unshift @INC, $lib;
$ENV{PERL5LIB} = $lib;
# Try again.
eval { require Bric };
die "Cannot locate Bricolage libraries.\n" if $@;
}
};
use Bric::Config qw(:ftp);
# make sure FTP is enabled
BEGIN {
unless (ENABLE_FTP_SERVER) {
print "\nENABLE_FTP_SERVER is off! Please read Bric::Admin for instructions on how to setup the FTP server.\n";
exit 1;
}
}
# load the server
use Bric::Util::FTP::Server;
# setup parameters
# no conf file used
push(@ARGV, '-C', '/dev/null');
# set port and address if specified
push(@ARGV, '-p', FTP_PORT);
if (FTP_ADDRESS() ne "") {
push(@ARGV, '-o', 'local address=' . FTP_ADDRESS);
}
# setup log
push(@ARGV, '-o', 'error log=' . FTP_LOG);
# set debug mode
if (FTP_DEBUG) {
push(@ARGV, '-d');
}
Bric::Util::FTP::Server->run;