I got it working now:
First I re-defined plugs and slots in snapcraft.yaml
:
plugs:
cups-internal:
interface: cups-control
slots:
# Provide the cups-control and cups slots for other snaps to connect to
cups-control:
interface: cups-control
cups:
interface: cups
I set the slots of cupsd as follows:
apps:
cupsd:
[...]
slots: [cups-control, cups]
On all other apps I replaced the plugs cups
and cups-control
by cups-internal
:
cups-browsed:
[...]
plugs: [network, network-bind, network-manager-observe, avahi-control, cups-internal]
lpinfo:
command: sbin/lpinfo
plugs: [network, cups-internal]
lpadmin:
command: sbin/lpadmin
plugs: [network, avahi-control, home, cups-internal]
lpstat:
command: bin/lpstat
plugs: [network, avahi-control, cups-internal]
[...]
I build CUPS with a configure option to call the cupsctl
API call with cups-control
as slot name:
parts:
[...]
cups:
[...]
configflags:
[...]
- --with-cups-control-slot=cups-control
[...]
Now I change the connection I requested in this thread to
sudo snap connect cups:cups-internal cups:cups-control
sudo snap connect cups:network-manager-observe
and for external utilities (example) I do the following connections:
sudo snap connect cups-admin-test:cups-control cups:cups-control
sudo snap connect cups-user-app-test:cups cups:cups
Now it all works as expected.
This means:
This request should be now considered as that following auto-connections are requested:
sudo snap connect cups:cups-internal cups:cups-control
sudo snap connect cups:network-manager-observe
The auto-connections are internally doing the same as the original ones, the interfaces are only renamed.
It must be assured that a Snap of a user application which prints and is put into the Snap Store should auto-connect its cups
plug to BOTH :cups
AND cups:cups
on installation. slots-per-plug: *
should be used at the right place for that.
Same for Snaps of printer managers using cups-control
with the difference that here explicit permission should be needed for auto-connection. Also here slots-per-plug: *
at the right place should be used.
@reviewers: I will commit my above-mentioned changes now, could you apply the changes as I described here? Thanks in advance.