Skip to Main Content
Managing IMAP
book

Managing IMAP

by Dianna Mullet, Kevin Mullet
September 2000
Beginner content levelBeginner
408 pages
10h 29m
English
O'Reilly Media, Inc.
Content preview from Managing IMAP

Appendix A. Conversion from Berkeley Mail Format to Cyrus: Tools

The procedure for converting a set of users from traditional Unix (Berkeley format) mail to Cyrus was outlined in Chapter 9, Cyrus System Administration . In this appendix, source code for the tools used in such a conversion is provided.

bsd2cyrus

bsd2cyrus is a Perl script, introduced in Chapter 9 , that maps a set of users’ Berkeley-format mail folders into the Cyrus namespace. The output of the bsd2cyrus script is used as input to other scripts that are used in converting users from a Berkeley-style mail system to a Cyrus system. bsd2cyrus takes as input the filename of a text file that contains a list of usernames. Example A-1 shows the bsd2cyrus script.

Example A-1. bsd2cyrus

#!/usr/local/bin/perl
    eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}'
        if $running_under_some_shell;

require "find.pl";

$inputfile  = "$ARGV[0]";
if (! $inputfile) { die "Usage: $0 inputfile\\n"; }

For each user, get the user’s home directory from the passwd file and search for the pathnames of all files under the user’s ~/mail directory. The find subroutine pushes those files onto an array. Note that the files are all pushed onto a single array, not an array per user—this is because we’re assuming that you’re converting a large batch of users all at one time and don’t need to do anything special on a per-user basis.

open (DATA, $inputfile) || die "can't open $inputfile"; while (<DATA>) { chop; ($user,$pw,$uid,$gid,$quota,$cmnt,$gcos,$home) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick
Why Sleep Is a Strategic Resource

Why Sleep Is a Strategic Resource

Gretchen Spreitzer, Christopher M. Barnes
The Kind Leader

The Kind Leader

Karyn Ross

Publisher Resources

ISBN: 059600012XSupplemental ContentCatalog PageErrata