<div dir="ltr">Hi David,<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 6:32 PM, David Garrod <span dir="ltr"><<a href="mailto:dgarrod@extremenetworks.com" target="_blank">dgarrod@extremenetworks.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="white" lang="EN-US" link="blue" vlink="purple"><div><p><span style="color:#1f497d"></span></p>
<p class="MsoNormal"><span style="color:#1f497d">Yes I know I can do some special messing around to try and fix up the installation but I don’t think that is a good idea. How can I get the package to install fully and correctly inside the SNAP, i.e. properly
 execute the “postinst” commands.</span></p></div></div></blockquote><div><br></div><div>Taking a step back, Snapcraft is a tool to help you assemble snaps from various pieces. The stage-package feature is meant to easily consume package contents, but it's not a perfect installation of a .deb honoring posting etc. At the moment, it just unpacks the .deb (dpkg -x) as if it was a tarball.</div><div><br></div><div>Capturing the installation of any possible .deb and its postinst would be quite complex:</div><div>- we'd have to run these postinsts with root permissions during the build (however we do sudo apt install on the build-packages, so that's technically possible albeit intrusive)</div><div>- we'd need a chroot and a way to record the changes done to this chroot (as to extract the new files)</div><div>- we'd need to decide what to do with modified/updated files</div><div><br></div><div>This is not out of the possible, but it's a lot of work and the "unpacking the .deb" heuristic works for most use cases.</div><div><br></div><div>Perhaps there should be a separate plugin which does the "true .deb" installation process in a chroot etc., but for your specific traceroute use case it seems easier to just add the missing symlinks created by update-alternatives yourself (or simply move the binaries to the expected place!)</div><div><br></div><div>Alternatively, you could also build traceroute from source instead of reusing the .deb.</div><div><br></div><div>Cheers,</div><div>- Loïc Minier</div></div></div></div>