Le 09/08/2016 à 09:53, BlinCT . a écrit : > Good afternoon. Hey Alexey,
> My name is Alexey > I write for the first time, hoping to get advice from you > Recently I started to try building a programs into Snap package. I > need to build a demon. But unfortunatly there was a many problems due > working. I faced on the lacking of documentation and description of > the principle operation with demons. > I will try to describe the work and attaching a file with yaml file > and binary file (f2d). > The system should work with 2 demons, snmpd and my own sub-agent. snmp > service is working with system. sub-agent is handle our requests, > which are not known for the snmpd. > snmp should be able to "--start" and "--stop". > sub-agent can running with different keys, for example ./f2d -Lo -n > > My questions: > 1. How to make packaging into snap pack with 2 demons if I want a > program running only by root and with the keys? You just add different wrapper scripts (enabling one or the other with some conditions) I would say triggering one or the other in this shell scripts before starting the real daemon. Then, you can have two names under apps: in your snapcraft.yaml, each command pointing to one of the wrapper script. > 2. How to work with file out of $SNAP? You basically can't and shouldn't really on files outside of $SNAP apart from really rare exceptions. The whole idea of snaps is that upstream source is relocatable. Most of the times, they have some env variables that you can set to ensure it's reading the files where you want them to read (and you want them to read/create files in $SNAP*) > 3. I collect snmp, he unpackage /etc/snmp/snmpd.conf and then I want > to replace it by my own snmpd.conf. how to do it? I think that depends on snpmd itself. You need to look at the source and see if there is a parameter for the daemon like -c <config_file> or an environment variable to point to some non hardcoded path. I'm sure making that relocatable would be a welcome contribution by upstream if it's not possible already! > 4. The system have snmp. Could I install and work with other snmp in a > program, if snmp was build in snap package? I don't really know snmp itself, but as they communicating via TCP or such? I don't think unix socket connection would be possible without defining an interface (and some people reading this list can help you getting started with this). If the communication is all network-y, you just need to use then the "network" and "network-bind" interface (if you are listening to incoming requests) for this. I hope that helped! Didier -- Snapcraft mailing list Snapcraft@lists.snapcraft.io Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft