diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-09-21 20:16:06 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-09-21 20:16:06 +0000 |
commit | e1b5ebf9bc57e9eff1f082664cf88fbe4e9b554d (patch) | |
tree | d48d05093a6643516deabee1f268ebf4fd90f35a /testing/vpopmail/vpopmail-Maildir-dotmaildir-fix.sh | |
parent | 0ea3c910afb7428ac63516dc0ab0dc1614a51c21 (diff) | |
download | aports-e1b5ebf9bc57e9eff1f082664cf88fbe4e9b554d.tar.bz2 aports-e1b5ebf9bc57e9eff1f082664cf88fbe4e9b554d.tar.xz |
testing/vpopmail: new aport
inter7 virtual email domain management system
http://www.inter7.com/vpopmail/
Diffstat (limited to 'testing/vpopmail/vpopmail-Maildir-dotmaildir-fix.sh')
-rwxr-xr-x | testing/vpopmail/vpopmail-Maildir-dotmaildir-fix.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/vpopmail/vpopmail-Maildir-dotmaildir-fix.sh b/testing/vpopmail/vpopmail-Maildir-dotmaildir-fix.sh new file mode 100755 index 00000000..fb289aba --- /dev/null +++ b/testing/vpopmail/vpopmail-Maildir-dotmaildir-fix.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-mail/vpopmail/files/vpopmail-Maildir-dotmaildir-fix.sh,v 1.2 2004/10/19 17:55:24 robbat2 Exp $ +# Written by Robin H. Johnson, robbat2@gentoo.org + +OLDNAME='Maildir' +NEWNAME='.maildir' +SEARCHPATH=/var/vpopmail/domains/ +MINDEPTH=3 +# If you have a very large vpopmail deployment, you may need to increase MAXDEPTH. +MAXDEPTH=6 + +if [ "${1}" == '--revert' ]; then + SEARCHNAME="${NEWNAME}" + REPLACENAME="${OLDNAME}" +else + SEARCHNAME="${OLDNAME}" + REPLACENAME="${NEWNAME}" +fi + +echo "Doing '${SEARCHNAME}' '${REPLACENAME}' changeover" +echo find ${SEARCHPATH} -name "${SEARCHNAME}" -maxdepth $MAXDEPTH -mindepth $MINDEPTH -type d +for i in `find ${SEARCHPATH} -name "${SEARCHNAME}" -maxdepth $MAXDEPTH -mindepth $MINDEPTH -type d`; do + foundname=${i/${SEARCHNAME}*}${SEARCHNAME} + base="`dirname $i`" + todoname=${base}/${REPLACENAME} + #echo "$foundname -> $todoname" + echo "Fixing `echo $base | sed -e "s|${SEARCHPATH}||g"`" + chmod +t $base + if [ -L ${todoname} ]; then + echo Removing symlink "${todoname}" + rm ${todoname} + fi + if [ -e ${todoname} ]; then + echo "Error! Cannot move ${i} as destination exists!" + continue + fi + mv "${foundname}" "${todoname}" + ln -s "${todoname}" "${foundname}" + chown vpopmail:vpopmail "${foundname}" + chmod -t $base +done; |