);
GetOptions(\%options,
- 'daemon|D','show|s','search|select|S','mirror|M', 'stop',
+ 'daemon|D','show|s','search|select|S','mirror|M', 'stop|exit|quit',
'detach!',
'css=s','cgi_bin|cgi-bin|cgi=s',
'verbose|v+','quiet|q+',
my @USAGE_ERRORS;
if (1 != grep {exists $options{$_}} qw(daemon show search mirror stop)) {
- push @USAGE_ERRORS,"You must pass one (and only one) of --daemon --show --search or --mirror";
+ push @USAGE_ERRORS,"You must pass one (and only one) of --daemon --show --search --mirror or --stop";
}
$options{verbose} = $options{verbose} - $options{quiet};
print STDERR "Unable to determine if daemon is running: $!\n";
exit 1;
}
+ my $conf = IO::File->new($options{mirror_location}.'/debbugs_config_local','w') or
+ die "Unable to open $options{mirror_location}/debbugs_config_local for writing: $!";
+ print {$conf} <<"EOF";
+\$gConfigDir = "$options{mirror_location}";
+\$gSpoolDir = "$options{mirror_location}";
+\$gWebHost = 'localhost:$options{port}';
+\$gPackageSource = '';
+\$gPseudoDescFile = '';
+\$gPseudoMaintFile = '';
+\$gMaintainerFile = '';
+\$gMaintainerFileOverride = '';
+\$config{source_maintainer_file} = '';
+\$config{source_maintainer_file_override} = '';
+\$gProject = 'Local Debbugs';
+1;
+EOF
+ close $conf;
+ $ENV{DEBBUGS_CONFIG_FILE} = $options{mirror_location}.'/debbugs_config_local';
# ok, now lets daemonize
# XXX make sure that all paths have been turned into absolute
sub handle_request {
my ($self,$cgi) = @_;
+ $ENV{DEBBUGS_CONFIG_FILE} = $options{mirror_location}.'/debbugs_config_local';
my $base_uri = 'http://'.$cgi->virtual_host;
if ($cgi->virtual_port ne 80) {
$base_uri .= ':'.$cgi->virtual_port;
);
my ($output,$error) = ('','');
my $h = IPC::Run::start(['rsync',@{$param{options}}],
- \undef,\$output,\$error);
+ \undef,$param{log},$param{log});
while ($h->pump) {
- print {$param{log}} $output,$error;
#print {$param{debug}} $error if defined $param{debug};
}
$h->finish();