#!/bin/bash if [ $# -ne 1 ]; then echo "Usage: $0 list_name" exit 1 fi echo 'This script needs to be run as user mailman and only after verifying' echo "/srv/mailman/archives/private/$1.mbox/$1.mbox" echo "is good (scripts in /opt/mailman/git/hyperkitty/hyperkitty/contrib/) and" echo "checking https://mail.python.org/mailman/admindb/$1 for pending requests." echo "Held messages if any will be backed up." echo 'Type "Yes" to continue; anything else to quit.' read -p "> " response if [ "x$response" != "xYes" ] ; then exit; fi rsync -a /srv/mailman/lists/$1 /opt/mailman/backup-mm2/ ||\ { echo rsync failed ; exit 1; } if [ -n "`find /srv/mailman/data/ -type f -name heldmsg-$1-\[0-9\]\*.pck`" ]; then echo Backing up held messages for msg in `find /srv/mailman/data/ -type f -name heldmsg-$1-\[0-9\]\*.pck` ; do rsync $msg /opt/mailman/backup-mm2/$1/ ; done ||\ { echo held message backup failed ; exit 1; } fi cd /opt/mailman/backup-mm2/$1 /opt/mailman/mm/bin/mailman create $1@python.org > create.ot ||\ { echo create failed ; exit 1; } echo MM3 list $1@python.org created. /opt/mailman/mm/bin/mailman import21 $1@python.org \ /opt/mailman/backup-mm2/$1/config.pck > import21.ot ||\ { echo import21 failed ; exit 1; } echo MM2 config imported. /srv/mailman/bin/rmlist $1 || { echo rmlist failed ; exit 1; } echo MM 2 list removed. if [ -f /opt/mailman/backup-mm2/$1/digest.mbox ] ; then echo moving digest.mbox. /opt/mailman/move_digest $1 fi if [ -f /srv/mailman/archives/private/$1.mbox/$1.mbox ] ; then /opt/mailman/mm/bin/mailman-web-django-admin hyperkitty_import -l $1@python.org\ --no-sync-mailman \ /srv/mailman/archives/private/$1.mbox/$1.mbox > hkimport.ot 2> hk_error||\ { echo hk_import failed ; exit 1; } if [ -s hk_error ] ; then echo Check hk_error; fi echo Archives imported with --no-sync-mailman. Run echo django-admin mailman_sync echo "but if doing multiple lists, it's only needed after the last one." fi echo Check these templates for edit or removal find /opt/mailman/mm/var/templates/lists/$1.python.org -type f echo echo Add these lines to /etc/apache2/sites-enabled/mail.python.org-ssl.conf echo " RedirectMatch permanent /mailman/listinfo/$1(/.*)?\$ \\" echo " https://mail.python.org/mailman3/lists/$1.python.org/" if [ ! -d /srv/mailman/archives/public/$1 ] ; then exit; fi echo echo "The old archive is public, so add these lines to" echo "/srv/mailman/archives/private/$1/index.html" echo "

" echo " This list has been migrated to Mailman 3. This archive is not being" echo " updated." echo " " echo " Here is the new archive including these old posts." echo "

"