Blocking the Debian/Ubuntu provided Kopano packages

Starting with Ubuntu 18.04 (Bionic Beaver) and Debian 10 (Buster) packages for the Kopano Groupware are not only available from Kopano itself, but also directly available from the package repositories of your distribution. These packages unfortunately follow a different naming schema, than the ones provided by Kopano, which can lead to a bit of confusion and cases them to not be directly compatible with each other.

Below you can find a small recipe on preventing the accidental install of such a package by the means of an apt preferences file. This file needs to be placed into /etc/apt/preferences.d/ and while the Debian team does not require a certain naming I would suggest to call it kopano.pref.

# give packages from Kopano a higher priority
Package: *
Pin: origin "download.kopano.io"
Pin-Priority: 600

Package: *
Pin: origin "repo.z-hub.io"
Pin-Priority: 600

# blacklist packages that are only in the Debian repository
Package: kopano-core kopano-l10n kopano-libs kopano-contacts kopano-webapp-apache2 kopano-webapp-common kopano-webapp-contactfax kopano-webapp-files kopano-webapp-folderwidgets kopano-webapp-lighttpd kopano-webapp-nginx z-push
Pin: origin *
Pin-Priority: -1

In case you are running your own repository you need to replace the origin with your local one. You can read out the required values from apt-cache policy.