GBrowse
view release on metacpan or search on metacpan
install_util/GBrowseGuessDirectories.pm view on Meta::CPAN
}
sub htdocs {
my $self = shift;
local $^W = 0;
return File::Spec->catfile($PREFIX,'htdocs') if $PREFIX;
return '/srv/gbrowse2/htdocs' if $ENV{DEB_BUILD_ARCH};
my $root = $self->apache_root;
foreach ('htdocs','html') {
return File::Spec->catfile($root,$_)
if -e File::Spec->catfile($root,$_);
}
for (
'/var/www/html', # RedHat linux
'/var/www/htdocs', # Slackware linux
'/var/www', # Ubuntu/debian
'/var/www', # Ubuntu
'/Library/Webserver/Documents', # MacOSX
) {
return File::Spec->catfile($_,'gbrowse2') if -d $_;
}
return '/usr/local/apache/htdocs'; # fallback
}
sub cgibin {
my $self = shift;
my $root = $self->apache_root;
foreach ('cgi-bin','cgi-perl','cgi') {
return File::Spec->catfile($root,$_)
if -e File::Spec->catfile($root,$_);
}
for (
'/var/www/cgi-bin', # RedHat & Slackware linux
'/usr/lib/cgi-bin', # Ubuntu/debian
'/Library/Webserver/CGI-Executables', # MacOSX
'/usr/lib/cgi-bin', # Ubuntu
) {
return "$_/gb2" if -d $_;
}
return '/usr/local/apache/cgi-bin/gb2'; #fallback
}
# try a few ports until we find an open one
sub portdemo {
my $self = shift;
my @candidates = (80,8000,8080,8001,8008,8081,8888,8181);
for my $port (@candidates) {
my $h = IO::Socket::INET->new(LocalPort=>$port);
return $port if $h;
}
}
sub wwwuser {
my $self = shift;
for (qw(www-data www httpd apache apache2 System nobody )) {
return $_ if getpwnam($_);
}
# fallback -- user current real user
return (getpwuid($<))[0];
}
sub installconf {
my $self = shift;
return 'y';
}
sub installetc {
my $self = shift;
return 'y';
}
sub apachemodules {
my $self = shift;
my $root = $self->apache_root;
foreach ('modules','libexec') {
return File::Spec->catfile($root,$_)
if -d File::Spec->catfile($root,$_);
}
return '/etc/httpd/modules' if -d '/etc/httpd/modules';
for my $first ('/usr/lib','/usr/share',
'/usr/local/lib','/usr/local/share') {
for my $second ('apache','apache2') {
for my $third ('modules','libexec') {
my $candidate = File::Spec->catfile($first,$second,$third);
return $candidate if -d $candidate;
}
}
}
return '/usr/lib/apache/modules'; #fallback
}
# most (all?) distributions have a way to add config file snippets
# to httpd.conf without modifying the main file
sub apache_includes {
my $self = shift;
return '/etc/apache2/other' if -d '/etc/apache2/other'; # why cant macos do things like everybody else?
return '/etc/apache2/conf.d' if -d '/etc/apache2/conf.d';
return '/etc/apache2/conf-enabled' if -d '/etc/apache2/conf-enabled';
return '/etc/apache/conf.d' if -d '/etc/apache/conf.d';
return '/etc/httpd/conf.d' if -d '/etc/httpd/conf.d';
return;
}
1;
( run in 0.869 second using v1.01-cache-2.11-cpan-b16cb0d3907 )