Skip to content

Instantly share code, notes, and snippets.

@tpokorra
Created October 1, 2013 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpokorra/6775616 to your computer and use it in GitHub Desktop.
Save tpokorra/6775616 to your computer and use it in GitHub Desktop.
Kolab: fixes CyrusIMAP problems with 32 bit to 64 bit migration, annotations.db folder-type
# call with domain name as parameter, eg. ./fixannotations.sh mydomain.org
domain="user/*@$1"
acceptedFolderTypes=(
"event" "event.default"
"contact" "contact.default"
"note" "note.default"
"task" "task.default"
"journal" "journal.default"
"mail.outbox" "mail.sentitems" "text/plain")
validFolderType () {
for e in "${acceptedFolderTypes[@]}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}
kolab list-mailbox-metadata $domain | grep "Folder\|folder-type" | while read line
do
if [[ $line == Folder* ]]
then
folder=${line:7}
else
foldertype=`echo $line | cut -d " " -f 2`
origfoldertype=$foldertype
if [[ $foldertype = "t" || $foldertype = "t.default" ]]; then foldertype="even"$foldertype; fi
if [[ $foldertype = "act" || $foldertype = "act.default" ]]; then foldertype="cont"$foldertype; fi
if [[ $foldertype = "nal" || $foldertype = "nal.default" ]]; then foldertype="jour"$foldertype; fi
if [[ $foldertype = ".sentitems" ]]; then foldertype="mail.sentitems"; fi
if [[ $foldertype = ".outbox" ]]; then foldertype="mail.outbox"; fi
if [[ $foldertype = "t/plain" ]]; then foldertype="text/plain"; fi
if [[ $foldertype = "" || $foldertype = ".default" ]]
then
if [[ $folder == *Notizen* ]]; then foldertype="note"$foldertype; fi
if [[ $folder == *Aufgaben* ]]; then foldertype="task"$foldertype; fi
fi
validFolderType $foldertype
if [ $? -eq 1 ]
then
echo $folder
echo " ERROR unknown foldertype " $foldertype
exit
else
if [[ $foldertype != $origfoldertype ]]
then
echo "Folder "$folder
echo " " $origfoldertype $foldertype
kolab set-mailbox-metadata \
"${folder}" \
"/shared/vendor/kolab/folder-type" \
"${foldertype}"
fi
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment