Article View: news.software.nntp
Article #49776Re: FAQ? Different group names on incoming feed and locally (INN)
From: Russ Allbery
Date: Wed, 10 Jan 2001 11:28
Date: Wed, 10 Jan 2001 11:28
97 lines
4390 bytes
4390 bytes
Liam Friel <liam.friel@s3group.com> writes:
> I have a problem which is probably a FAQ for INN but I can't find the
> answer. Even more annoying, I know I did something similar about two
> years ago but I can't for the life of me remember how.
> I want to move a bunch of local groups from one INN server to a
> replacement server, while:
> 1. Preserving all existing posting history
> 2. Renaming the groups and re-organising the group structure.
> Moving them to the other server while keeping the same group
> structure/name is easy. But I can't remember how to simultaneously pull
> off the renaming of the groups ...
> The current server is INN 2.2 on RedHat, the new server will be INN (?)
> on Solaris.
Try a modification of the following script. As is, it only fixes Xref
headers (it was originally intended to prep a tree of old articles from a
pre-1.5 server that didn't all have Xref headers for transfer to a 2.3
server), but you could tweak it to change the Newsgroups and Xref headers
to change the names of the groups to which the articles will be posted.
Then use find to generate a list of files from the tree created by this
script and pass that to innxmit.
#!/usr/bin/perl
$ID = q$Id: fixref,v 1.1 2001/01/10 11:27:37 eagle Exp $;
#
# fixref -- Fix the Xref headers in a tree of news articles.
#
# Written by Russ Allbery <rra@stanford.edu>
# Copyright 2000 Board of Trustees, Leland Stanford Jr. University
#
# Copy a tree of traditional spool news articles, fixing the Xref headers as
# we go. Add Xref headers if missing (based on the path to the article),
# and if an Xref header is present, trim out hierarchies other than those
# given on the command line.
#
# Usage: fixref -a <hierarchy-pattern> <from> <to> <hierarchy>
use strict;
use vars qw($ALLOW $COUNT %DONE $FROM $ID $TO);
use File::Find qw(find);
use File::Path qw(mkpath);
use Getopt::Long qw(GetOptions);
sub copy {
return unless -f $_;
return unless /^\d+$/;
my $path = $File::Find::dir;
$path =~ s%^\Q$FROM\E/*%%;
open (SRC, "< $_") or die "Can't open $File::Find::name: $!\n";
mkpath ("$TO/$path", 0, 0755) unless $DONE{$path}++;
open (DST, "> $TO/$path/$_") or die "Can't open $TO/$path/$_: $!\n";
my $header = 1;
my $havexref = 0;
while ($header) {
my $line = <SRC>;
if ($line =~ /^Xref: /) {
if ($ALLOW) {
my ($xref, $server, @groups) = split (' ', $line);
@groups = grep { /$ALLOW/ } @groups;
$line = join (' ', $xref, $server, @groups) . "\n";
}
$havexref = 1;
} elsif ($line =~ /^[\r\n]*$/) {
unless ($havexref) {
my $group = $path;
$group =~ tr%/%.%;
$group .= ":$_";
print DST "Xref: fixref $group\n";
}
$header = 0;
}
print DST $line;
}
local $_;
print DST while <SRC>;
close SRC;
close DST or die "Can't flush $TO/$path/$_: $!\n";
print "$COUNT articles processed\n" if ((++$COUNT % 100) == 0);
}
GetOptions ('allow|a=s' => \$ALLOW) or exit 1;
my $hierarchy;
($FROM, $TO, $hierarchy) = @ARGV;
die "Usage: fixref [-a <allow>] <from> <to> <hierarchy>\n"
unless $hierarchy;
find (\©, "$FROM/$hierarchy");
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Technical Details
Message-ID:
<ylwvc3abo9.fsf@windlord.stanford.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!216.218.236.179.MISMATCH!news!news.he.net!newsfeed.direct.ca!look.ca!logbridge.uoregon.edu!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mailReferences:
<3a5c4552.0@seat.s3two.ie>Show Full Headers
Complete Article Headers
Message-ID: <ylwvc3abo9.fsf@windlord.stanford.edu> Subject: Re: FAQ? Different group names on incoming feed and locally (INN) Date: Wed, 10 Jan 2001 11:28:38 +0000 From: Russ Allbery <rra@stanford.edu> References: <3a5c4552.0@seat.s3two.ie> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!supernews.google.com!sn-xit-02!supernews.com!216.218.236.179.MISMATCH!news!news.he.net!newsfeed.direct.ca!look.ca!logbridge.uoregon.edu!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail Newsgroups: news.software.nntp Organization: The Eyrie Lines: 96 NNTP-Posting-Host: windlord.stanford.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)