X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=debian%2Fdebbugsconfig;h=e98decc7255d402110ff6e19daa4af8bc302a57f;hb=867420593c939cf9585bd42f558778ad598076b9;hp=8819962d939b4bb4a82d18f728eade520e456fd5;hpb=390295a97f787accb53f0660441ea9a1b2dc86a9;p=debbugs.git diff --git a/debian/debbugsconfig b/debian/debbugsconfig index 8819962..e98decc 100755 --- a/debian/debbugsconfig +++ b/debian/debbugsconfig @@ -1,8 +1,13 @@ #!/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 <> $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 "$gWebDir/$html.html: $!"; + open(DEST, ">$gWebDir/$html.html") || die "\n$gWebDir/$html.html: $!"; print DEST $name; close(DEST); - print "wrote $gWebDir/$html.html\n"; + 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 "$gDocDir/$text.html: $!"; + open(DEST, ">$gDocDir/$text.html") || die "\n$gDocDir/$text.html: $!"; $name =~ s,\nOther pages:\n.*?
,,si; print DEST $name; close(DEST); unlink("$gDocDir/$text.txt"); - $ENV{'HOME'} = "/dev/null"; + $ENV{'HOME'} = "/tmp"; $ENV{'TERM'} = "linux"; - system ("lynx -nolist -dump -cfg=$gConfigDir/html/lynx-cfg $gDocDir/$text.html > $gDocDir/$text.txt") == 0 || - die "unable to write $gDocDir/$text.txt\n"; - unlink("$gDocDir/$text.html") || die "can't remove temporary file $gDocDir/$text.html: $!"; - print "wrote $gDocDir/$text.txt\n"; + 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 "; }