/[smeserver]/rpms/dovecot/sme7/migrate-users
ViewVC logotype

Contents of /rpms/dovecot/sme7/migrate-users

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Tue Jun 12 15:07:20 2007 UTC (17 years, 4 months ago) by slords
Branch: MAIN
CVS Tags: dovecot-1_0-1_2_rc15_el4_sme, dovecot-1_0_7-2_el4_sme, HEAD
Import on branch sme7 of package dovecot-1.0-1.2.rc15.el4.sme.src.rpm

1 #!/bin/bash
2 # file: migrate-users
3 # author: Richard Keech <rkeech@redhat.com>
4
5 # This script assists in the conversion of mail boxes
6 # in mbox format to maildir format.
7 # See also migrage-folders.
8
9 #This is a list of users to have their mail folders created.
10 #One user per line.
11 #Suggest create with cut -d: -f1 /etc/passwd > ~/migrate/u1
12 #then remove inappropriate entries by hand.
13 USERLIST=/root/migrate/userlist
14
15 #Specify the location of the new location for mail folders.
16 #This cannot be the same as the old location because it will
17 #create directory names that contend with existing file names.
18 NEWBASE=/var/spool/mail2/
19
20 echo this will create user mail folders in $NEWBASE from
21 echo the list of users in $USERLIST.
22 echo
23 echo "Do you want to continue? (y/n)"
24 read ans
25 if [ "$ans" != "y" ]
26 then
27 echo Good Bye.
28 exit 0
29 fi
30
31 if [ ! -f "$USERLIST" ]
32 then
33 echo Error: user list file \"$USERLIST\" does not exist.
34 exit 1
35 fi
36
37 if [ ! -d "$NEWBASE" ]
38 then
39 echo Error: new base directory \"$NEWBASE\" does not exist.
40 exit 1
41 fi
42
43 while read user
44 do
45 if grep ^${user}: /etc/passwd &> /dev/null
46 then
47 echo User \"$user\" is OK.
48 else
49 echo User \"$user\": is bogus.
50 exit 1
51 fi
52
53 mkdir ${NEWBASE}/$user
54 newdir="${NEWBASE}/${user}/"
55 mkdir -p "$newdir"/cur
56 mkdir -p "$newdir"/new
57 mkdir -p "$newdir"/tmp
58 chmod -R 770 "${newdir}"
59 chown -R ${user}:mail "$newdir"
60 done < $USERLIST
61
62 echo
63 echo New mail directories have been created under $NEWBASE
64 echo
65 echo If required, prepare a list of existing mbox folders
66 echo as /root/migrate/folderlist and run migrate-folders.
67 echo
68 echo To make the new base mail directory active, change the
69 echo mail_spool_directory setting for postfix using
70 echo postconf -e \"mail_spool_directory = ${NEWBASE}/\"
71 echo and change Dovecots default_mail_env setting in
72 echo /etc/dovecot.conf to
73 echo default_mail_env = maildir:${NEWBASE}/%u
74 echo
75 echo If you want to migrate existing mail folders then defer
76 echo the dovecot and postfix changes until the folder migration
77 echo is complete.

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed