summaryrefslogtreecommitdiff
path: root/net-mail/vpopmail/files/vpopmail-Maildir-dotmaildir-fix.sh
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-mail/vpopmail/files/vpopmail-Maildir-dotmaildir-fix.sh
reinit the tree, so we can have metadata
Diffstat (limited to 'net-mail/vpopmail/files/vpopmail-Maildir-dotmaildir-fix.sh')
-rw-r--r--net-mail/vpopmail/files/vpopmail-Maildir-dotmaildir-fix.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/net-mail/vpopmail/files/vpopmail-Maildir-dotmaildir-fix.sh b/net-mail/vpopmail/files/vpopmail-Maildir-dotmaildir-fix.sh
new file mode 100644
index 000000000000..758cced2d885
--- /dev/null
+++ b/net-mail/vpopmail/files/vpopmail-Maildir-dotmaildir-fix.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# 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;