How do I get a postinst stage properly executed - traceroute will not install correctly

Didier Roche didrocks at ubuntu.com
Thu Jul 28 06:14:16 UTC 2016


Le 27/07/2016 à 18:00, David Garrod a écrit :
>
> I’m trying to get the “traceroute” package to install properly inside
> my SNAP. To do this I’ve added
>
>  
>
> traceroute
>
>  
>
> to the
>
>  
>
>     stage-packages:
>
>  
>
> line in my snapcraft.yaml. The files to get put into the;
>
> /snap/openswitch-appliance/x1/…
>
>  
>
> $SNAP tree and indeed I can then see them from inside the SNAP.
>
>  
>
> root at Snappy-Appliance:/home/netop# find $SNAP -name "traceroute*"
>
> /snap/openswitch-appliance/x1/usr/bin/traceroute-nanog
>
> /snap/openswitch-appliance/x1/usr/bin/traceroute.db
>
> /snap/openswitch-appliance/x1/usr/bin/traceroute6.db
>
> /snap/openswitch-appliance/x1/usr/share/doc/traceroute
>
> /snap/openswitch-appliance/x1/usr/share/man/man1/traceroute-nanog.1.gz
>
> /snap/openswitch-appliance/x1/usr/share/man/man1/traceroute.db.1.gz
>
> /snap/openswitch-appliance/x1/usr/share/man/man1/traceroute6.db.1.gz
>
>  
>
> But the problem is that the installation isn’t properly finished
> because the the postinst stage didn’t get run. If you look at the
> postinst stage for the traceroute package you’ll see what I’ve listed
> below.
>
>  
>
> In other words for this package to work it is meant to build some
> softlinks to /etc so that “traceroute” is actually made available.
>
>  
>
> How am I meant to do this is the SNAP world?
>

Hey Dave,

Looking at the postinst, it doesn't seem this is actually that you need
to execute any postinst in this specific case. The update-alternative
calls here are just to make available a default "traceroute" binary
pointing to your "usr/bin/traceroute.db" (same for manual page). You can
expose it directly through apps to get the same result:
apps:
  traceroute:
    command: $SNAP/usr/bin/traceroute.db

If the issue is that other commands from this package are using
"traceroute" internally, you can ship a symlink yourself that you ensure
are in your $PATH snap.

Cheers,
Didier

>  
>
> Thanks,
>
>  
>
> Dave Garrod
>
>  
>
> % cat DEBIAN/postinst
>
> #!/bin/sh
>
>  
>
> set -e
>
>  
>
> case "${1}" in
>
>         configure)
>
>                 update-alternatives --install \
>
>                         /usr/bin/traceroute traceroute
> /usr/bin/traceroute.db 100 \
>
>                         --slave /usr/sbin/traceroute traceroute.sbin \
>
>                                 /usr/bin/traceroute.db \
>
>                         --slave /usr/share/man/man1/traceroute.1.gz
> traceroute.1.gz \
>
>                                 /usr/share/man/man1/traceroute.db.1.gz
>
>  
>
>                 for _ALTERNATIVE in traceroute6 lft traceproto
>
>                 do
>
>                         update-alternatives --install \
>
>                                 /usr/bin/${_ALTERNATIVE}
> ${_ALTERNATIVE} /usr/bin/${_ALTERNATIVE}.db 100 \
>
>                                 --slave
> /usr/share/man/man1/${_ALTERNATIVE}.1.gz ${_ALTERNATIVE}.1.gz \
>
>                                        
> /usr/share/man/man1/${_ALTERNATIVE}.db.1.gz
>
>                 done
>
>  
>
>                 for _ALTERNATIVE in tcptraceroute
>
>                 do
>
>                         update-alternatives --install \
>
>                                 /usr/sbin/${_ALTERNATIVE}
> ${_ALTERNATIVE} /usr/sbin/${_ALTERNATIVE}.db 100 \
>
>                                 --slave
> /usr/share/man/man8/${_ALTERNATIVE}.8.gz ${_ALTERNATIVE}.8.gz \
>
>                                        
> /usr/share/man/man8/${_ALTERNATIVE}.db.8.gz
>
>                 done
>
>                 ;;
>
>  
>
>         abort-upgrade|abort-remove|abort-deconfigure)
>
>  
>
>                 ;;
>
>  
>
>         *)
>
>                 echo "postinst called with unknown argument \`${1}'" >&2
>
>                 exit 1
>
>                 ;;
>
> esac
>
>  
>
>  
>
>  
>
> exit 0
>
>  
>
>
> ------------------------------------------------------------------------
>
> DISCLAIMER:
> This e-mail and any attachments to it may contain confidential and
> proprietary material and is solely for the use of the intended
> recipient. Any review, use, disclosure, distribution or copying of
> this transmittal is prohibited except by or on behalf of the intended
> recipient. If you have received this transmittal in error, please
> notify the sender and destroy this e-mail and any attachments and all
> copies, whether electronic or printed.
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160728/a8294287/attachment.html>


More information about the Snapcraft mailing list