#!/bin/sh
# Mixmaster version 2.9  --  (C) 1999 Anonymizer Inc. and others.

# Mixmaster may be redistributed and modified under certain conditions.
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
# ANY KIND, either express or implied. See the file COPYRIGHT for
# details.

# $Id: upgrade 651 2003-11-07 06:52:03Z weasel $

# readln text default
readln()
{
  echo $echo1 "$1 [$2] $echo2"
  read ans
  if [ -z "$ans" ]
  then
    ans="$2"
  fi
}

echo "This script will upgrade an installation of Mixmaster 2.0."
echo "Do not use this script to upgrade an installation of Mixmaster 2.9."
echo "Use the Install script instead."
readln "Continue with upgrade?" n
 if [ "$ans" = n ]
 then
  exit 1
 fi

NEW=~/tmp.$$
mkdir $NEW

cp $MIXSRC/mix $NEW/mix
cd $NEW
ln -s mix mixmaster
cp $MIXDEST/mixrand.bin $MIXDEST/id.log $MIXDEST/pubring.mix $MIXDEST/secring.mix $MIXDEST/type2.list $MIXDEST/stats.log $MIXDEST/urls .
cp $MIXDEST/mix.list mlist.txt
cp $MIXDEST/mix.help help.txt
cp $MIXDEST/mix.key key.txt
grep -v '#' $MIXDEST/headers.del | sed 's#^#/#;s#$#/#' | grep -v '//' >header.blk
grep -v '#' $MIXDEST/destination.block | sed 's#^#/#;s#$#/#' | grep -v '//' >dest.blk
grep -v '#' $MIXDEST/source.block | sed 's#^#/#;s#$#/#' | grep -v '//' >source.blk

cat /dev/null >mix.cfg
grep SENDMAIL $MIXDEST/mixmaster.conf >>mix.cfg
grep SHORTNAME $MIXDEST/mixmaster.conf >>mix.cfg
grep REMAILERADDR $MIXDEST/mixmaster.conf >>mix.cfg
grep ANONADDR $MIXDEST/mixmaster.conf >>mix.cfg
grep COMPLAINTS $MIXDEST/mixmaster.conf >>mix.cfg
grep REMAILERNAME $MIXDEST/mixmaster.conf >>mix.cfg
grep ANONNAME $MIXDEST/mixmaster.conf >>mix.cfg
grep POOLSIZE $MIXDEST/mixmaster.conf >>mix.cfg
grep RATE $MIXDEST/mixmaster.conf >>mix.cfg
grep NEWS $MIXDEST/mixmaster.conf | grep -v mail-to-news >>mix.cfg
grep ORGANIZATION $MIXDEST/mixmaster.conf >>mix.cfg
grep MAILtoNEWS $MIXDEST/mixmaster.conf | sed 's/MAILtoNEWS/NEWS/' >>mix.cfg

cat <<END >>mix.cfg

# Supported formats:
MIX		y
PGP		y
UNENCRYPTED	n

# Filter binary attachments?
BINFILTER	y

# Maximum message size in kB:
SIZELIMIT	0

SENDPOOLTIME	1h
IDEXP		7d
PACKETEXP	7d

# Where to log error messages (file name or "syslog"):
ERRLOG		log

# Anti-spam message IDs on Usenet (MD5 of message body)?
MID		y

# Where to deliver non-remailer messages:
MAIL    stdout

END

mv $MIXDEST $MIXDEST.old
mv $NEW $MIXDEST


syntax highlighted by Code2HTML, v. 0.9.1