CUPS in a snap: avahi-daemon needed

Jamie Strandboge jamie at canonical.com
Wed Jan 25 19:54:55 UTC 2017


On Wed, 2017-01-25 at 15:29 -0200, Till Kamppeter wrote:
> Hi,
> 
> I am currently snapping CUPS (both for server and for desktop/phone 
> printing needs) and testing it on Ubuntu Core.
> 
> Here I have found out that there is no avahi-daemon (which CUPS needs 
> for sharing local printers and for discovering remote network printers.
> 
> Now I want to know what I have to do. Is there already a snap of 
> avahi-daemon?

I just checked the store: not yet.

>  How can I make it a dependency of the CUPS snap?

Snaps don't have dependencies per se. How it works is through interfaces such
that CUPS would say it wants to use avahi and it would be installable only on
systems where there the slot is available. I'm not up to date on this, but last
I heard the bits about auto-installing slot implementations, recommending what
slot to install, blocking when a slot snap isn't installed, etc is not
implemented yet, but it will be.


> What have 
> I to do with the CUPS snap so that I can actually use the avahi-daemon snap?
> 
> If there is no avahi-daemon snap, do I need to ship avahi-daemon with 
> the CUPS snap?
> 
> Is there anyone who needs avahi-daemon for his snap and has solved the 
> problem already? If yes, how?

As mentioned, there isn't an avahi-daemon snap at this time, but I think it
would be useful for people generall.

What is available is the 'avahi-observe' interface on classic systems. cups-
browsed can today 'plugs: [ avahi-observe ]' to find printers on the network via
avahi on classic systems.

For advertising your printers you would need to create a new interface and to
make this work on all-snaps (Ubuntu Core) systems as well as classic. Here is
what I suggest:

 * first snap avahi-daemon using devmode
 * update the avahi-observe interface to be used with your avahi-daemon snap
   which will now 'slots: [avahi-observe]' such that people can use 'snap 
   connect' to connect snaps that 'plugs: [avahi-observe]' to your snap and be 
   able find services that your snap sees on the network
 * create the avahi-advertise interface to be used with your avahi-daemon snap
   which will now 'slots: [avahi-advertise]' such that people can use 'snap
   connect' to connect snaps that 'plugs: [avahi-advertise]' to your snap and be
   able to advertise services via your snap. Also account for using
   avahi-advertise on classic systems where avahi-daemon is installed as a deb
 * adjust your avahi-daemon snap to work in strict mode, updating the connected 
   plug/slot policy as necessary and creating the permanent slot policy in the 
   avahi-observe and avahi-advertise interfaces you just created
 * submit the PR and enjoy :)

Look at location-observe and location-control as examples on how to split the
interfaces for a single service as inspiration for avahi-observe and avahi-
advertise. Look at pulseaudio for how to make avahi-observe and avahi-advertise
work for both classic and all-snaps systems.

To do the above, I suggest you read Zygmunt's blog series:
http://www.zygoon.pl/2016/08/creating-your-first-snappy-interface.html

-- 
Jamie Strandboge             | http://www.canonical.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20170125/7a271303/attachment.sig>


More information about the Snapcraft mailing list