I'm trying to rewrite an init script to systemd, but I'm struggling with an issue of optional dependencies.
My service depends (optionally) on two other services. These two dependencies are mutually exclusive (server and client package) - only one can be installed at a time, and can be missing completely.
If either of the dependencies is installed, the dependency should be started before my service, and if the start fails, my service should not start.
But if neither of the dependencies is installed, my service should start normally.
How can I achieve this functionality? Optional dependencies are handled through
Wants=, but this ignores errors.