This evening I renamed a number of UWCS's mailing lists for a few reasons, mostly due to the annoying ambiguity of the old names. Mailman doesn't make this particularly easy - this how you can do it under Etch;

$ OLD=old-list-name
$ NEW=new-list-name
$ set -u
$ sudo /etc/init.d/mailman stop
$ sudo test -a /var/lib/mailman/archives/private/${NEW} && echo '*** That mailing list name already exists. ***'
$ sudo mv /var/lib/mailman/lists/${OLD} /var/lib/mailman/lists/${NEW}
$ sudo mv /var/lib/mailman/archives/private/${OLD} /var/lib/mailman/archives/private/${NEW}
$ sudo mv /var/lib/mailman/archives/private/${OLD}.mbox /var/lib/mailman/archives/private/${NEW}.mbox
$ sudo mv /var/lib/mailman/archives/private/${NEW}.mbox/${OLD}.mbox /var/lib/mailman/archives/private/${NEW}.mbox/${NEW}.mbox
$ sudo /var/lib/mailman/bin/arch ${NEW}
$ sudo cp /etc/aliases `mktemp aliases-backup.XXXX`
$ sudo printf "\\n# '${OLD}' -> '${NEW}' mailing list rename \\n" | sudo tee --append /etc/aliases
$ echo "${OLD}: ${NEW}" | sudo tee --append /etc/aliases
$ for SUFFIX in admin bounces confirm join leave owner request subscribe unsubscribe; do echo "${OLD}-${SUFFIX}: ${NEW}-${SUFFIX}" | sudo tee --append /etc/aliases; done
$ sudo newaliases
$ sudo /var/lib/mailman/bin/genaliases
$ sudo /etc/init.d/mailman start

# For bonus points, generate yourself Apache redirect for the new name:

$ echo "RewriteRule ^/([^/]*)/${OLD}($|(/.*)) /\\$1/${NEW}\\$2\\$3 [R=301,L]"

Ta-da, nice new names. You will need to warn your users as their filtering will now have broken.

§

Tags: GNU/Linux
Planets: ALUG UWCS WUGLUG Debian

§

Six comments

  1. Thanks for this article. You saved me a lot of time trying to figure it out myself.

    It almost works as written for Ubuntu (7.04), except:
    <code>
    sudo /etc/init.d/mailman <i>stop</i>
    sudo <i>bash</i> -c "[[ -a /var/lib/mailman/archives/private/${NEW} ]] &amp;&amp; echo '*** That mailing list name already exists. *** '"
    </code>

    And add backslashes
    <code>
    echo "RewriteRule ^/([^/]*)/${OLD}(\$|(/.*)) /\$1/${NEW}\$2\$3 [R=301,L]"
    </code>

    Arnold Daniels

  2. Thanks. I've reworked the ``sudo bash -c..`` line now to use ``test`` explicitly. I had added those slashes, but Wordpress eated it.

    — lamby

  3. Great tutorial, thanks. On my instance of mailman I can't change the real_name attribute: "Error: real_name attribute not changed! It must differ from the list's name by case only." Is there a way to force this so that I can get past step 5? :)

    Tyler Mitchell

  4. @Tyler: Not sure. Can you reply with your version of Mailman and distribution? You could probably just get away with editing the database but Mailman is very funny these sorts of things (lots of stuff generated from the database might not be updated until you run some esoteric command).

    — lamby

  5. Wow, this just saved me lots of headaches. I pretty much copy/pasted all the steps and it worked without a problem.

    Thanks!

    Steven Bakker

  6. Did I miss where you setup the NEW aliases, or does one of those commands do it automatically?

    Tom M

    I believe genaliases does that for you, but I don't have a working mailman instance handy to try.

    lamby

Reply

§