Thanks to Canonical's push to get Snaps adopted by everyone, they've created a tool called Snapcraft which makes building a Snap relatively easy. Having said that, there are a few gotchas that Raoul encountered while trying to build a Snap on Debian.
First we'll need Snap. Install
snapd on either Ubuntu or Debian:
$ sudo apt install snapd
If you're running Ubuntu 16.04 and up, Snapcraft is already part of your distro. If you're running another operating system you can use their Docker image to run Snapcraft on an Ubuntu 16.04 base.
We recommend using Docker anyway, as it provides a clean build environment without extra dependencies that one might have installed but forgotten about.
First, install Docker. Once Docker is installed, make sure the service is running:
$ sudo service docker status
Make sure you followed the instructions on the Docker site to add your
user to the group so that you don't have to use
sudo with Docker.
Lastly you'll want to pull the Snapcraft Docker image down:
$ docker pull snapcore/snapcraft
Building the Snap
Now that you have the Snapcraft image, you'll need the
file. Raoul currently has this file in a separate repository for
automated building on Launchpad in future. Let's grab it:
$ bzr branch lp:~raoul-snyman/openlp/snapcraft
Now you should just be able to build the snap from there.
$ docker run -v $PWD:$PWD -w $PWD snapcore/snapcraft bash -c "apt update && apt upgrade -y && snapcraft clean && snapcraft"
This build can easily take up to 20 minutes to complete (longer if you're on a slower machine), so go get yourself a cup of coffee while you wait for it to finish.
Once the build is done, you should have a file that is named something
openlp_2.4.5_amd64.snap in the same directory as the
Installing the Snap
Obviously once you're done building, you want to install the snap.
Installing locally unsigned snaps is supported via the
command line argument. Yep, it can be dangerous!
$ sudo snap install openlp_2.4.5_amd64.snap --dangerous
That should take all of a few seconds to install, quite an anticlimax after the lengthy build! Now, let's test it out by running:
And if all went well you should see OpenLP!