--- /dev/null
+#!/usr/bin/perl -w
+
+# This script checks if the translations of the documents are up to date.
+# When called with "-d" option, it also prints what has changed in the
+# original since last translation
+
+# SYNOPSIS:
+# ./doc-check [-d] [-v] [-V] [lang]
+#
+# (uses $lang set below if lang is not given on commandline)
+
+use Getopt::Std;
+$opt_d = $opt_v = $opt_V = 0;
+getopts('dvV');
+# You may set this to your default language code
+$lang = shift || "pl";
+
+sub checkdiff
+{
+ my ($plfname, $enfname) = (@_);
+ my ($plrev, $enrev) = getrev($plfname, $enfname);
+ $plrev and $enrev or return;
+ if ( "$plrev" ne "$enrev" ) {
+ if ($opt_d) {
+ my $s = "cvs diff -b -u -r $plrev -r $enrev $enfname";
+ warn "running $s:\n" if ($opt_V);
+ system($s);
+ } else {
+ print "$enfname : $plrev -> $enrev\n";
+ }
+ }
+}
+
+sub getrev
+{
+ my ($plfname, $enfname) = (@_);
+ my ($plrev, $enrev) = (0, 0);
+
+ warn "checking $plfname:\n" if $opt_v;
+ open FILE, $plfname or warn "$plfname: $!\n" and return;
+ while (<FILE>) {
+ if (/<!--\s*original version\D*([\d\.]+)\s*-->/) {
+ $plrev = $1;
+ last;
+ }
+ if (/<!--\s*original document: en\/\S+, revision ([\d\.]+)\s*-->/) {
+ $plrev = $1;
+ last;
+ }
+ }
+ warn "checking $enfname:\n" if $opt_v;
+ open FILE, $enfname or warn "$enfname: $!\n" and return;
+ while (<FILE>) {
+ if (/\$Id: [^\s]+ ([\d\.]+) .* Exp \$/) {
+ $enrev = $1;
+ last;
+ }
+ if (/\$Revision: ([\d\.]+) \$/) {
+ $enrev = $1;
+ last;
+ }
+ }
+ close FILE;
+ warn "failed to find revision for $plfname\n" unless $plrev;
+ warn "failed to find revision for $enfname\n" unless $enrev;
+ return ($plrev, $enrev);
+}
+
+@subdocs = ("welcome", "hardware", "preparing", "inst-methods", "rescue-boot", "partitioning", "kernel", "boot-new", "post-install", "tech-info", "appendix", "administrivia");
+
+foreach $doc (@subdocs) {
+ my $plfname = "$lang/" . "$doc" . ".sgml";
+ my $enfname = "en/" . "$doc" . ".sgml";
+ checkdiff($plfname, $enfname);
+}
+checkdiff("install.$lang.sgml", "install.sgml");
+checkdiff("release-notes.$lang.sgml","release-notes.sgml");
+checkdiff("index.$lang.html.m4","index.en.html.m4");
+checkdiff("dselect-beginner.$lang.sgml","dselect-beginner.sgml");