/usr/share/perl5/Debian/Dwww/ConfigFile.pm is in dwww 1.13.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | # vim:ft=perl:cindent:ts=4:sts=4:sw=4:et:fdm=marker:cms=\ #\ %s
#
package Debian::Dwww::ConfigFile;
use Exporter();
use Sys::Hostname;
use strict;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(ReadConfigFile WriteConfigFile);
sub ReadConfigFile($) {
my $filename = shift;
my $hostname = &hostname();
$hostname =~ s/\..*$//;
my $cfgvars = {
# Basic configuration variables
'DWWW_SERVERNAME' => {
sort => 10,
defval => 'localhost',
descr => 'Name of the www server dwww(1) will connect to.'
},
'DWWW_SERVERPORT' => {
sort => 10,
defval => 80,
descr => 'Port of the www server dwww(1) will connect to.'
},
'DWWW_USEHTTPS' => {
sort => 15,
defval => 'no',
descr => 'Should dwww(1) use the HTTPS protocol for connecting.'
},
'DWWW_DOCROOTDIR' => {
sort => 10,
defval => '/var/www',
descr => 'The document root for web server.'
},
'DWWW_CGIDIR' => {
sort => 10,
defval => '/usr/lib/cgi-bin',
descr => 'The directory which contains the CGI scripts for the web server.'
},
'DWWW_CGIUSER' => {
sort => 10,
defval => 'www-data',
descr => 'Name of the user the web server uses to execute CGI script.'
},
# Browser variables
'DWWW_BROWSER' => {
sort => 20,
defval => '',
descr => 'Web-browser used by dwww(1) to load dwww main page.'
},
'DWWW_X11_BROWSER' => {
sort => 20,
defval => '',
descr => 'Web-browser used by dwww(1) to load dwww main page in X11 mode.'
},
# Path variables
'DWWW_DOCPATH' => {
sort => 30,
defval => '/usr/share/doc:/usr/share/info:/usr/share/man:/usr/local/share/doc:'
. '/usr/local/share/info:/usr/local/share/man:/usr/share/common-licenses',
descr => 'Colon-delimited list of directories dwww-convert(8) supplies files from.'
},
'DWWW_ALLOWEDLINKPATH' => {
sort => 35,
defval => '/usr/share:/usr/lib:/usr/local/share:/var/www',
descr => 'Colon-delimited list of directories that could be targets of symlinks.'
},
# Cache files locations
'DWWW_QUICKFIND_DB' => {
sort => 40,
defval => '/var/cache/dwww/quickfind.dat',
descr => 'Location of cache of installed packages and programs.'
},
'DWWW_REGDOCS_DB' => {
sort => 45,
defval => '/var/cache/dwww/regdocs.dat',
descr => 'Location of cache of doc-base registered documents.'
},
'DWWW_DOCBASE2PKG_DB' => {
sort => 45,
defval => '/var/cache/dwww/docbase2pkg.dat',
descr => 'Location of cache of doc-base file to package mapping.'
},
# Documentation indexing variables
'DWWW_INDEX_DOCUMENTATION' => {
sort => 50,
defval => 'yes',
descr => 'Should dwww-index++(8) index documentation with swish++.'
},
'DWWW_INDEX_FULL_TIME_INTERVAL' => {
sort => 50,
defval => 28,
descr => 'How often (in days) dwww-index++(8) will generate full index of documentation.'
},
'DWWW_INDEX_INCREMENTAL_TIME_INTERVAL' => {
sort => 50,
defval => 7,
descr => 'How often (in days) dwww-index++(8) will generate incremental index of documentation.'
},
'DWWW_MERGE_MAN2HTML_INDEX' => {
sort => 55,
defval => 'no',
descr => 'Should dwww-index++(8) use index generated by man2html.'
},
# Other variables
'DWWW_KEEPDAYS' => {
sort => 60,
defval => 10,
descr => 'How many days should dwww-refresh-cache(8) keep documents that have not been accessed.'
},
'DWWW_TMPDIR' => {
sort => 60,
defval => '/var/lib/dwww',
descr => 'Temporary directory used by dwww-build(8) and dwww-build-menu(8).'
},
'DWWW_USEFILEURL' => {
sort => 60,
defval => 'no',
descr => 'Should dwww-convert(8) generate file:/ urls.'
},
'DWWW_TITLE' => {
sort => 60,
defval => 'dwww: ' . $hostname,
descr => 'Title to appear on dwww generated files.'
},
'DWWW_USE_CACHE' => {
sort => 60,
defval => 'yes',
descr => 'Should dwww cache accessed documents?'
}
};
if ($filename && -r $filename)
{
open DWWWCONF, "<", $filename or die "Can't open $filename: $!\n";
while (<DWWWCONF>) {
chomp();
# Note: the same regexp is used in debian/dwww.config
next if /^\s*#/;
if (m/^\s*([^=]+)\s*=\s*['"]?([^'"\s]+)['"]?\s*$/) {
$cfgvars->{$1}->{'cfgval'} = $2;
}
}
close DWWWCONF or die "Can't close $filename: $!\n";
}
return $cfgvars;
}
sub WriteConfigFile($$)
{
my $filename = shift;
my $cfgvars = shift;
open DWWWCONF, ">", "$filename" or die "Can't open $filename for writing: $!\n";
print DWWWCONF "## Dwww configuration file, see dwww(7) for details.\n";
print DWWWCONF "## The file is in Bourne shell script format, thus no spaces\n";
print DWWWCONF "## may be used in variables assignments.\n\n";
foreach my $key(sort { my $s1 = defined $cfgvars->{$a}->{'sort'} ? $cfgvars->{$a}->{'sort'} : 999;
my $s2 = defined $cfgvars->{$b}->{'sort'} ? $cfgvars->{$b}->{'sort'} : 999;
my $v = $s1 <=> $s2;
return $v == 0 ? $a cmp $b: $v;
} keys %$cfgvars)
{
my $defval = $cfgvars->{$key}->{'defval'};
my $cfgval = $cfgvars->{$key}->{'cfgval'};
my $descr = $cfgvars->{$key}->{'descr'};
print DWWWCONF "## $descr\n" if $descr;
print DWWWCONF "## default: $defval\n" if $defval;
if ($cfgval)
{
print DWWWCONF "$key='$cfgval'\n";
}
elsif (defined $defval)
{
print DWWWCONF "# $key='$defval'\n";
}
print DWWWCONF "\n";
}
close DWWWCONF or die "Can't close $filename: $!\n";
}
1;
|