--- rpms/smeserver-dovecot-extras/contribs10/smeserver-dovecot-extras.spec 2022/08/08 06:21:11 1.10 +++ rpms/smeserver-dovecot-extras/contribs10/smeserver-dovecot-extras.spec 2022/08/08 06:50:50 1.11 @@ -108,9 +108,17 @@ rm -rf $RPM_BUILD_ROOT /usr/sbin/groupadd -g 439 sharedmailbox 2> /dev/null || : %post -# Migrate the sharedmailbox dict to its new location -if [ -e /etc/dovecot/sharedmailbox/dict.db ]; then - mv -f /etc/dovecot/sharedmailbox/dict.db /home/e-smith/db/dovecot/sharedmailbox.db +if [ -s /home/e-smith/db/dovecot/sharedmailbox.db ] ; then + # echo "we already have a non empty file at destination" ; + # delete etc file if empty + if [ -e /etc/dovecot/sharedmailbox/dict.db ] ; then + # if exists and not empty we backup, else we delete + [ -s /etc/dovecot/sharedmailbox/dict.db ] && mv -f /etc/dovecot/sharedmailbox/dict.db /home/e-smith/db/dovecot/dictdb.old || rm -rf /etc/dovecot/sharedmailbox ; + fi +elif [ -e /etc/dovecot/sharedmailbox/dict.db ]; then + # if exists and not empty + [ -s /home/e-smith/db/dovecot/sharedmailbox.db ] && mv -f /etc/dovecot/sharedmailbox/dict.db /home/e-smith/db/dovecot/sharedmailbox.db ; + # then we remove the etc dir ; rm -rf /etc/dovecot/sharedmailbox fi