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

David Garrod dgarrod at extremenetworks.com
Wed Jul 27 16:00:54 UTC 2016


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?

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/20160727/2705417c/attachment.html>


More information about the Snapcraft mailing list