Skip to content

Instantly share code, notes, and snippets.

@waynegraham
Created August 27, 2019 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waynegraham/25ad0a38ce4cdbfac5e80bc5e5f6ab76 to your computer and use it in GitHub Desktop.
Save waynegraham/25ad0a38ce4cdbfac5e80bc5e5f6ab76 to your computer and use it in GitHub Desktop.
Migrate Sympa to Listserv

Howto

I did this in Vagrant just to keep everything separate. You need a script and the unsupported mailman2lsv tool from lsoft.

  • vagrant up
  • cd /vagrant/
  • chmod +x sympa2mbox.py
  • sympa2mbox.py [archive directory] > archive.mbox

Edit mailman2lsv/mbox2lsv.pl. Create a file (lists_to_migrate.txt) with the archive you're wanting to migrate. Then edit $lpdir to the current directory where the .mbox file is located.

$lpdir = "/vagrant/";

This generates a new directory, output that contains the files for listserv.

#!/usr/bin/env python
import os
import sys
basedir = sys.argv[1]
for month in sorted(os.listdir(basedir)):
print(month)
if os.path.exists(os.path.join(basedir, month)):
for msg_id in sorted(map(int, os.listdir(os.path.join(basedir, month)))):
fh = open(os.path.join(basedir, month, str(msg_id)), "r")
sys.stdout.write("From nobody Thu Jan 1 00:00:00 1970\n")
last_line = None
for line in fh:
last_line = line
if line.startswith("From "):
sys.stdout.write(">")
sys.stdout.write(line)
if last_line is not None:
if not last_line.endswith("\n"):
sys.stderr.write("adding newline")
sys.stdout.write("\n")
sys.stderr.flush()
sys.stdout.flush()
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision "shell", inline: <<-SHELL
apt-get update
apt-get upgrade
apt-get install -y python libmail-mboxparser-perl
SHELL
end
@fngundam
Copy link

Wayne,
Thanks for the info. Is it possible for one to migrate from Sympa to Listserv without using vagrant?

@waynegraham
Copy link
Author

I just used Vagrant to make a test environment to make sure it would work. If it works, you just need the mailman2lsv script from LSoft. It’s not supported, but the engineers at LSoft are really quite generous answering questions.

@fngundam
Copy link

fngundam commented Oct 15, 2020 via email

@fngundam
Copy link

fngundam commented Nov 12, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment