Great Circle Associates Majordomo-Users
(October 1996)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: utility: help upgrade list to 1.94
From: "Kenneth C. Rich" <kenr @ bridge . cc . rochester . edu>
Date: Mon, 28 Oct 1996 08:24:46 -0500 (EST)
To: majordomo-users @ GreatCircle . COM

for comment:
a utility that creates a 1.94 list config from a 1.93 or earlier list config
and creates a sample list.intro file.  it also squirts out very simple
minded list aliases, but...

did i miss any config var name changes?  any other easy conversion task
it could do?  it makes assumption that for instance get_access = list
is close enough to private_get = yes for starters.

various things you will have to customize up at the top of course.
and this line too, down around line 88, which i should move up toward
the other configurables:

    $template = "$majorhome/UCC/config.template";

which is the name of my 1.94 list config template file.
no man page, run it with -help option to see terse usage message.
i call it upgradelist, but name it as you wish.

thanks in advance!

--
-ken rich   Klein bottle for sale... inquire within.   kenr@cc.rochester.edu

---------------------------------------------------------------------------
#!/usr/ucc/bin/perl

#H# 
#H# A program to help upgrade a majordomo 1.93 mailing list to 1.94
#H# by converting the list-name.config to 1.94-osity and creating
#H# a list-name.intro file.
#H# 
##
## comments starting with '#H# ' become part of the $0 -help message!!!!!!!
##
## kenr@cc.rochester.edu - Mon Oct 28 08:22:17 EST 1996
## Copyrat 1996 University of Rochester Computing Center
#
#- kenr@cc.rochester.edu (10/96) - bring up to speed with majordomo-1.94
#

$VERSION = "1.94";
$majorhome = "/usr/ucc/lib/majordomo";
$majorhost = "cc.rochester.edu";
( ! -d $majorhome && -d "$majorhome-$VERSION" ) &&
    ( $majorhome = "$majorhome-$VERSION" );

$majordomo_userid = 'majord';
$majordomo_gid = 1;
( $majordomo_uid, $majordomo_gid ) = ( getpwnam( $majordomo_userid ))[2, 3];
$> = $majordomo_uid;
$) = $majordomo_gid;
if( $> && ( $> ne $majordomo_uid )) {
    die( "$0: must be run by root or $majordomo_userid\n" );
}

##
## ------------------------------ ARGV ------------------------------
##

while( $ARGV[0] =~ /^-/ ) {
    $_ = shift;
    ( /^-h$/ || /^-help$/ ) && ( &Usage, next );
    /^-host$/ && ( $majorhost = shift, next );
    /^-home$/ && ( $majorhome = shift, next );
    &Usage;
}
$name = shift;
$listhome = "$majorhome/lists";
sub Usage {
    local( $_ ) = shift;
    local( @text ) = `cat $0`;
    $0 =~ s-^.*/--;
    print "Usage: $0 [-h] [-host mj-host] [-home mj-home-dir] list-name
    -h             print out this help message.
    -host host     use alternate hostname as majordomo-host.
    -home homedir  use alternate majordomo home dir (alt installation).
$_";
    foreach( @text ) { s/^#H# ?// && print $_; }
    exit shift;
}

# {
# 	package config;
# 	require( "$main'majorhome/majordomo.cf" );
# }	## end of package config ##
# $majorhome = $config'homedir;
# $listhome = $config'listdir;
# $hostname = $config'whereami;

print "This script aids in upgrading a 1.93 mailing list to 1.94.\n";
print "----------------------------------------------------------\n";

##
## ------------------------------ MAIN ------------------------------
##

##
## Read the old config, memorize information
##
%old_config = ();
$config = "$listhome/$name.config";
!open( OC, "$config" ) && die( "$config config file open/read error\n" );
while( <OC> ) {
    chop;
    /=/ || next;
    ( $var, $val ) = split( /\s*=\s*/ );
    $old_config{ $var } = $val;
}
close OC;

##
## Roughly customize the config template according to settings in old config.
##
umask( 0117 );
$template = "$majorhome/UCC/config.template";
$new_config = "$listhome/$name.config.NEW";
!open( TP, "$template" ) && die( "$template file open/read error\n" );
!open( CF, ">$new_config" ) && die( "$new_config file open/write error\n" );
$date = `/bin/date`; chop $date;
$user = getlogin;

$old_config{'private_get'} = ( $old_config{'private_get'} = 'yes' )?
    'list': 'open';
$old_config{'private_index'} = ( $old_config{'private_index'} = 'yes' )?
    'list': 'open';
$old_config{'private_who'} = ( $old_config{'private_who'} = 'yes' )?
    'list': 'open';
$old_config{'private_which'} = ( $old_config{'private_which'} = 'yes' )?
    'list': 'open';
$old_config{'private_info'} = ( $old_config{'private_info'} = 'yes' )?
    'list': 'open';

while( <TP> ) {
    chop;
    s/#delete0#.*/Configuration file for $name mail list, Majordomo $VERSION./;
    s/#delete1#.*/Upgraded on $date by $user./;
    s/^(moderate)\s*=.*/$1 = $old_config{$1}/;
    s/^(admin_passwd)\s*=.*/$1 = $old_config{$1}/;
    s/^(approve_passwd)\s*=.*/$1 = $old_config{$1}/;
    s/^(description)\s*=.*/$1 = $old_config{$1}/;
    s/^(precedence)\s*=.*/$1 = bulk/;
    s/^(maxlength)\s*=.*/$1 = $old_config{$1}/;
    s/^(date_info)\s*=.*/$1 = $old_config{$1}/;
    s/^(strip)\s*=.*/$1 = $old_config{$1}/;
    s/^(get_access)\s*=.*/$1 = $old_config{'private_get'}/;
    s/^(index_access)\s*=.*/$1 = $old_config{'private_index'}/;
    s/^(intro_access)\s*=.*/$1 = $old_config{'private_info'}/;
    s/^(info_access)\s*=.*/$1 = $old_config{'private_info'}/;
    s/^(who_access)\s*=.*/$1 = $old_config{'private_who'}/;
    s/^(which_access)\s*=.*/$1 = $old_config{'private_which'}/;
    s/^(reply_to)\s*=.*/$1 = $old_config{$1}/;
    s/^(sender)\s*=.*/$1 = $old_config{$1}/;
    s/^(subscribe_policy)\s*=.*/$1 = $old_config{$1}/;
    s/^(unsubscribe_policy)\s*=.*/$1 = $old_config{$1}/;
    print CF $_, "\n";
}

close CF;
close TP;
# chmod( 0660, $config );
# chown( $majordomo_uid, $majordomo_gid, "$config" );

##
## Use the description to write a new member intro file
##
umask( 0113 );
$intro = "$listhome/$name.intro";
!open( INTRO, ">$intro" ) && die( "$intro file open/write error\n" );
print INTRO 'The ', $name, '@', $majorhost, " Majordomo mailing list\n\n";
$intro_moderated = ( $old_config{'moderate'} eq 'yes' ) ?
    "if approved by the list moderator" : "automatically";
$intro_subscribe = ( $old_config{'subscribe_policy'} eq 'closed' ) ?
    "requires approval by the list admin" : "is open to anyone";
$intro_access = ( $old_config{'who_access'} eq 'list' ) ?
    "only to list members" : "to anyone";
print INTRO "Membership in this mailing list $intro_subscribe.
Information about this list and its members is available $intro_access.
Messages mailed to $name\@$majorhost are forwarded to the list members
$intro_moderated. 
 
To learn more about using Majordomo, send email to
 
    majordomo\@$majorhost
 
containing only the word \"help\" in the body of the message.
 
If you have any questions or problems,
send email to owner-$name\@$majorhost.
 
Thankyou!\n";
close INTRO;
chmod( 0664, $intro );

$aliases = "/var/tmp/$name.aliases";
!open( ALIASES, ">$aliases" ) && die( "$aliases file open/write error\n" );
print "The following mail aliases are copied to the file $aliases for\n";
print "your editing convenience.  Majordomo does not use the file $aliases\n";
print "so you may delete it after using it.\n\n";

# if( $new ) {
#     @text = (
# 	"(You may need to add the following 6 lines to /etc/aliases:)\n\n",
# 	"#\n",
# 	"# majordomo adminstrative aliases\n",
# 	"#\n",
# 	"majordomo: \"|/usr/ucc/lib/majordomo/wrapper majordomo\"\n",
# 	"owner-majordomo: majordomo-owner \n",
# 	"majordomo-owner: tricorder@cc.rochester.edu\n\n"
#     );
#     $text = join( '', @text );
#     print $text;
#     print ALIASES $text;
# }

@text = (
    "(You may need to add the following lines to a mail aliases file.\n",
    "  '$name-archive is optional; remove from its 2 lines if desired.\n",
    "  When done, run suex newaliases:)\n\n",

    "##\n",
    "## aliases for the $name list ##\n",
    "##\n",
    "#\n# $DESCRIPTION\n#\n",
    "$name:\"|$majorhome/wrapper resend -l $name -h $hostname -p bulk -f $name-owner -s $name-outgoing\"\n",
    "$name-outgoing: :include:$listhome/$name\n",
    "$name-request: \"|$majorhome/wrapper request-answer $name\"\n",
    "owner-$name: $name-owner\n",
    "$name-approval: $name-owner\n",
    "$name-owner: $owner,\n",
    "--------------------end of mail aliases addition---------------------\n",

    "\n",
    "After you edit the mail aliases file and run newaliases, your\n",
    "Mailing list should be all ready.\n\n",
);

$text = join( '', @text );	## there is actually a reason i did it this way,
print $text;			## but the reason is no longer valid...
print ALIASES $text;
close( ALIASES );

print "*********************************************************************\n";
print "** See the temporary file $aliases
** for an electronic copy of the aliases text printed above.\n";
print "*********************************************************************\n";

Indexed By Date Previous: Re: (Fwd) MAJORDOMO ABORT - Any ideas?
From: Brian Behlendorf <brian@hyperreal.com>
Next: the filename for a list....
From: "Christopher Josephes" <chrisj@polaristel.net>
Indexed By Thread Previous: Re: Updates to 1.94
From: Jason L Tibbitts III <tibbs@hpc.uh.edu>
Next: Re: utility: help upgrade list to 1.94
From: chris <chris@sparkie.osl.state.or.us>

Google
 
Search Internet Search www.greatcircle.com