/usr/sbin/debbugsconfig is in debbugs 2.6.0.
This file is owned by root:root, with mode 0o755.
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 | #!/usr/bin/perl
# debbugsconfig: copies debbugs configuration files from templates, and
# creates documentation in HTML and text
# Copyright (C) 1999 Darren Benham
# Copyright (C) 2000 Josip Rodin
# Licensed under the version 2 of the GNU General Public License as
# published by the Free Software Foundation
use POSIX qw(strftime);
use File::Path;
if (@ARGV) {
print STDOUT <<EOF;
Usage: $0
debbugsconfig will copy basic debbugs configuration files from templates
if they don't exist.
It will also create BTS user documentation in HTML and text.
EOF
exit(0);
}
$gConfigDir = "/etc/debbugs" if (!defined($gConfigDir));
&template("config", $gConfigDir);
require "$gConfigDir/config";
unshift @INC, $gConfigDir;
&template("text", $gConfigDir);
require "text";
&template("Maintainers", $gConfigDir);
&template("Maintainers.override", $gConfigDir);
&template("pseudo-packages.description", $gConfigDir);
&template("sources", "$gConfigDir/indices");
&template("nextnumber", $gSpoolDir);
&touch("$gSpoolDir/index.archive.realtime");
&touch("$gSpoolDir/index.db.realtime");
print "Creating directories in $gSpoolDir:\n";
for my $num (0 .. 99) {
&spooldirectory(sprintf('archive/%02d', $num));
&spooldirectory(sprintf('db-h/%02d', $num));
}
print "\n";
# stuff used when testing (comment out the above)
#unshift @INC, "../";
#require "../scripts/config.in";
#require "../scripts/text.in";
#$gWebDir = "gWebDir";
#$gDocDir = "gWebDir";
my $dtime = strftime "%a, %e %b %Y %T UTC", localtime;
$gHTMLTail =~ s/SUBSTITUTE_DTIME/$dtime/;
print "Creating files in $gWebDir:\n";
require('html/index.html.in');
&writefiles ('index', '', $gIndexHtml );
require('html/Access.html.in');
&writefiles ('Access', 'bug-log-access', $gAccessHtml );
require('html/Developer.html.in');
&writefiles ('Developer', 'bug-maint-info', $gDeveloperHtml );
require('html/Reporting.html.in');
&writefiles ('Reporting', 'bug-reporting', $gReportingHtml );
require('html/server-control.html.in');
&writefiles ('server-control', 'bug-maint-mailcontrol', $gControlHtml );
require('html/server-refcard.html.in');
&writefiles ('server-refcard', 'bug-mailserver-refcard', $gRefcardHtml );
require('html/server-request.html.in');
&writefiles ('server-request', 'bug-log-mailserver', $gRequestHtml );
print "\n";
exit(0);
# -------------------------------------------------------------------------- #
sub template {
my ($name, $destdir) = @_;
if (! -f "$destdir/$name") {
system("cp /usr/share/doc/debbugs/examples/$name $destdir/$name") == 0 ||
die "$!";
print "created $destdir/$name from template.\n";
}
}
sub touch {
my $name = shift;
unless (-f $name) {
open TOUCH, ">> $name" or die "open $name: $!";
close TOUCH;
print "created empty $name.\n";
}
}
sub spooldirectory {
my $name = shift;
unless (-d "$gSpoolDir/$name") {
mkpath("$gSpoolDir/$name");
print "$name ";
}
}
sub writefiles {
local ($html, $text, $name) = @_;
# first HTML
unlink("$gWebDir/$html.html");
open(DEST, ">$gWebDir/$html.html") || die "\n$gWebDir/$html.html: $!";
print DEST $name;
close(DEST);
print "$html.html ";
# now text
return if ($text eq ""); # for index.html
# This should be done with pipes instead of a temporary files, but lynx
# doesn't read HTML from stdin :/
open(DEST, ">$gDocDir/$text.html") || die "\n$gDocDir/$text.html: $!";
$name =~ s,\nOther pages:\n.*?<hr>,,si;
print DEST $name;
close(DEST);
unlink("$gDocDir/$text.txt");
$ENV{'HOME'} = "/tmp";
$ENV{'TERM'} = "linux";
if (-x "/usr/bin/links") {
system ("rm -rf /tmp/.links/") == 0 || die;
system ("links -dump $gDocDir/$text.html > $gDocDir/$text.txt") == 0 ||
die "\nunable to write $gDocDir/$text.txt\n";
system ("rm -rf /tmp/.links/");
} elsif (-x "/usr/bin/lynx") {
system ("lynx -nolist -dump -cfg=/dev/null $gDocDir/$text.html > $gDocDir/$text.txt") == 0 ||
die "\nunable to write $gDocDir/$text.txt\n";
} else {
print "unable to write text versions of the HTMLs!";
print "if you need them, install links or lynx and run debbugsconfig again";
return;
}
unlink("$gDocDir/$text.html") || die "\ncan't remove temporary file $gDocDir/$text.html: $!";
print "$text.txt ";
}
|