Intent-To-Package: Hunspell Dictionaries (Content Snap)

This snap tries to resolve the following issue via the use of the content interface:
Desktop: allow access to host hunspell dictionaries - snapd - snapcraft.io

It doesn’t supersede the host-exposing method though, but it works and can be a solution for distros that don’t ship Hunspell dictionaries (is there any?).

This snap simply grabs all the ‘hunspell-*’ packages from Ubuntu 16.04 archive, extracts it, stage and prime all the files under usr/share/hunspell and maps it to the consumer snap’s $SNAP/usr/share/hunspell

A working prototype has been made and can be accessible via:

# Install Snap #
sudo snap install --channel=beta hunspell-dictionaries

# Connect the Snap to the Mandatory Interface #
## hunspell-dictionaries: Providing hunspell dictionaries at $SNAP/usr/share/hunspell ##
sudo snap connect _consumer_snap_name_:_plug_name_ hunspell-dictionaries:hunspell-dictionaries

For the consumer snap to access the dictionaries, define the following plug in the consumer snap’s snapcraft.yaml:

plugs:
  hunspell-dictionaries-plug:
    content: hunspell-dictionaries
    interface: content
    target: $SNAP/usr/share/hunspell
    default-provider: hunspell-dictionaries:hunspell-dictionaries

, and install and prepend the optional launcher /snap/hunspell-dictionaries/current/bin/hunspell-launch in the depending snap’s app. command, this launcher simply sets the DICPATH environmental variable.

The source recipe can be accessed at Lin-Buo-Ren/hunspell-dictionaries-snap: Unofficial Snap Packaging for Hunspell Dictionaries, comments and patches are welcome.