Courier to dovecot indexes files' migration script called when upgrade required.
This script is installed in /usr/lib/alternc/ (perl script provided by wiki.dovecot.com)
This commit is contained in:
parent
928ac7f495
commit
c76d1916ce
|
@ -563,6 +563,7 @@ src/alternc-passwd -text
|
|||
src/alternc_add_policy_dovecot -text
|
||||
src/alternc_reload -text
|
||||
src/compress_logs.sh -text
|
||||
src/courier-dovecot-migrate.pl -text
|
||||
src/cron_users.sh -text
|
||||
src/cron_users_doit.sh -text
|
||||
src/delete_logs.sh -text
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
# Upgrading script to AlternC 1.1
|
||||
|
||||
CONFIG_FILE="/etc/alternc/local.sh"
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
umask 022
|
||||
|
@ -18,20 +18,50 @@ fi
|
|||
|
||||
. "$CONFIG_FILE"
|
||||
|
||||
MAIL_DIR="$ALTERNC_LOC/mail"
|
||||
|
||||
## This part update mails' file owner and group ##
|
||||
fix_mail() {
|
||||
read LOGIN GID || true
|
||||
while [ "$LOGIN" ]; do
|
||||
INITIALE=`echo $LOGIN |cut -c1`
|
||||
MAIL=$(echo $LOGIN |sed -e 's/\@/_/')
|
||||
MAIL=$(echo $LOGIN |sed -e 's/\@/_/')
|
||||
REP="$ALTERNC_LOC/mail/$INITIALE/$MAIL/"
|
||||
chown --recursive $GID:vmail "$REP"
|
||||
read LOGIN GID || true
|
||||
read LOGIN GID || true
|
||||
done
|
||||
}
|
||||
|
||||
query="select user,userdb_gid from dovecot_view"
|
||||
mysql --defaults-file=/etc/alternc/my.cnf --skip-column-names -B -e "$query" |fix_mail
|
||||
## End of mails' files owner and group fixing part ##
|
||||
|
||||
## This part does the migration from Courier IMAP and POP3, preserving IMAP UIDs and POP3 UIDLs. ##
|
||||
## It reads Courier's 'courierimapuiddb' and 'courierpop3dsizelist' files and produces 'dovecot-uidlist' file from it. ##
|
||||
# We warn user it will take some time to migrate all indexes
|
||||
echo " "
|
||||
echo "################################################"
|
||||
echo "# /!\ CONVERTING COURIER INDEXES TO DOVECOT /!\ "
|
||||
echo "# /!\ THIS MAY TAKE A WHILE ! /!\ "
|
||||
echo "# "
|
||||
echo "# If you want to regenerate specifics indexes, "
|
||||
echo "# remove related 'dovecot-uidlist' files in "
|
||||
echo "# $MAIL_DIR "
|
||||
echo "# then execute this command manually : "
|
||||
echo "# "
|
||||
echo "# perl \"/usr/lib/alternc/courier-dovecot-migrate.pl\" --to-dovecot --convert --recursive \"$MAIL_DIR\""
|
||||
echo "# "
|
||||
echo "# Add \"--overwrite\" option if you want to "
|
||||
echo "# overwrite ALL 'dovecot-uidlist' indexes "
|
||||
echo "################################################"
|
||||
echo " "
|
||||
|
||||
# Stoping dovecot service
|
||||
invoke-rc.d dovecot stop || true
|
||||
|
||||
# We call the migration script (provided by wiki.dovecot.com)
|
||||
perl "/usr/lib/alternc/courier-dovecot-migrate.pl" --to-dovecot --convert --recursive "$MAIL_DIR"
|
||||
|
||||
# Starting dovecot service
|
||||
invoke-rc.d dovecot start || true
|
||||
## End of migration part
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# Purpose of file: Makefile des binaires de /usr/lib/alternc
|
||||
# ----------------------------------------------------------------------
|
||||
SETUID=quota_edit quota_get mem_add mem_del du.pl
|
||||
SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh alternc_add_policy_dovecot rebuild_all_webconf.sh
|
||||
SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh alternc_add_policy_dovecot rebuild_all_webconf.sh courier-dovecot-migrate.pl
|
||||
LIBS=functions.sh functions_hosting.sh functions_dns.sh
|
||||
BIN=$(DESTDIR)/usr/lib/alternc/
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue