#!/bin/bash set -eu # Simple fixes to address the z-push failure in MIAB v60.1 on my Ubuntu 22.04 # Intended to be idempotent. It modifies system files, so no assurances on any other platform whatsoever... # See: # https://github.com/mail-in-a-box/mailinabox/issues/2178 # https://discourse.mailinabox.email/t/version-60-for-ubuntu-22-04-is-released/9558/53 # https://discourse.mailinabox.email/t/version-60-for-ubuntu-22-04-is-released/9558/43 if [ ! -e /usr/sbin/z-push-admin ] ; then ln -s /usr/local/lib/z-push/z-push-admin.php /usr/sbin/z-push-admin fi if [ ! -e /usr/sbin/z-push-top ] ; then ln -s /usr/local/lib/z-push/z-push-top.php /usr/sbin/z-push-top fi ls -la /usr/sbin/z-push-admin /usr/sbin/z-push-top # https://discourse.mailinabox.email/t/version-60-for-ubuntu-22-04-is-released/9558/13 # ipcsharedmemoryprovider=/usr/local/lib/z-push/backend/ipcsharedmemory/ipcsharedmemoryprovider.php # # from: ZLog::Write(LOGLEVEL_DEBUG, sprintf("%s(): Initialized mutexid %s and memid %s.", $class, $this->mutexid, $this->memid)); # to: ZLog::Write(LOGLEVEL_DEBUG, sprintf("%s(): Initialized %s and %s.", $class, $this->mutexid::class, $this->memid::class)); # simpler # from: mutexid %s and memid %s.", $class, $this->mutexid, $this->memid # to: %s and %s.", $class, $this->mutexid::class, $this->memid::class if [ ! -e $ipcsharedmemoryprovider.ORIG ] ; then sed -i.ORIG -e 's|\bmutexid %s and memid %s.", $class, $this->mutexid, $this->memid\b|%s and %s.", $class, $this->mutexid::class, $this->memid::class|' $ipcsharedmemoryprovider fi diff $ipcsharedmemoryprovider.ORIG $ipcsharedmemoryprovider || true # policies=/usr/local/lib/z-push/policies.ini # from: maxattsize = '' # to: maxattsize = '-1' if [ ! -e $policies.ORIG ] ; then sed -i.ORIG -e "s|^maxattsize = ''|maxattsize = '-1'|" $policies fi diff $policies.ORIG $policies || true # https://forum.kopano.io/topic/3680/caldav-sync-error-unsupported-operand-types-string-int/15 # caldav=/usr/local/lib/z-push/backend/caldav/caldav.php # from: $message->reminder = $interval->format("%i") + $interval->format("%h") * 60 + $interval->format("%a") * 60 * 24; # to: $message->reminder = $interval->format("%i") + $interval->format("%h") * 60 + $interval->format("%d") * 60 * 24; # simpler # from: $interval->format("%a") * 60 * 24; # to: $interval->format("%d") * 60 * 24; # Note: this modifies two lines, not just the one mentioned in the kopano link if [ ! -e $caldav.ORIG ] ; then sed -i.ORIG -e 's|$interval->format("%a") \* 60 \* 24;|$interval->format("%d") * 60 * 24;|' $caldav fi diff $caldav.ORIG $caldav || true echo echo OK ####### # # Output on my system # root@shed:~/config-mailinabox/z-push_bug# ./z-push-fix.sh # lrwxrwxrwx 1 root root 38 Dec 13 20:58 /usr/sbin/z-push-admin -> /usr/local/lib/z-push/z-push-admin.php # lrwxrwxrwx 1 root root 36 Dec 13 20:58 /usr/sbin/z-push-top -> /usr/local/lib/z-push/z-push-top.php # 45c45 # < ZLog::Write(LOGLEVEL_DEBUG, sprintf("%s(): Initialized mutexid %s and memid %s.", $class, $this->mutexid, $this->memid)); # --- # > ZLog::Write(LOGLEVEL_DEBUG, sprintf("%s(): Initialized %s and %s.", $class, $this->mutexid::class, $this->memid::class)); # 70c70 # < maxattsize = '' # --- # > maxattsize = '-1' # 842c842 # < $message->reminder = $interval->format("%i") + $interval->format("%h") * 60 + $interval->format("%a") * 60 * 24; # --- # > $message->reminder = $interval->format("%i") + $interval->format("%h") * 60 + $interval->format("%d") * 60 * 24; # 847c847 # < $message->reminder = $interval->format("%i") + $interval->format("%h") * 60 + $interval->format("%a") * 60 * 24; # --- # > $message->reminder = $interval->format("%i") + $interval->format("%h") * 60 + $interval->format("%d") * 60 * 24; # # OK