Add snap packaging.

This adds [snap](https://snapcraft.io) packaging to the project. See the
link for more information on snaps. Snap packages install on all Linux
distributions. On Ubuntu, snap confinement with apparmor and seccomp
provide an additional layer of security.

This snap sets up monerod as a systemd service, which should start
immediately on install. To access the wallet CLI, simply run `monero`
(/snap/bin/monero). I think it's a really quick & easy way to get
started with monero.

I've made some opinionated decisions in the packaging just to kick this
off, but I'm happy to iterate on this stuff.
This commit is contained in:
Casey Marshall 2016-09-01 14:23:36 -05:00
parent afe3cce7fe
commit 0a56d83d3d
6 changed files with 85 additions and 1 deletions

11
contrib/snap/daemon.bash Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash -e
export HOME=${SNAP_DATA}
cd ${SNAP_DATA}
ARGS=
if [ -e "${SNAP_DATA}/etc/monerod.conf" ]; then
ARGS="--config-file ${SNAP_DATA}/etc/monerod.conf"
fi
exec ${SNAP}/bin/monerod --detach $ARGS

3
contrib/snap/log.bash Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash -e
exec tail -c +0 -F ${SNAP_DATA}/.bitmonero/bitmonero.log

6
contrib/snap/wallet.bash Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash -e
export HOME=${SNAP_USER_DATA}
cd ${SNAP_USER_DATA}
exec ${SNAP}/usr/bin/rlwrap ${SNAP}/bin/monero-wallet-cli "$@"

62
snapcraft.yaml Normal file
View file

@ -0,0 +1,62 @@
name: monero
version: 0 # TODO: change this to release version in CI builds
summary: "Monero: the secure, private, untraceable cryptocurrency https://getmonero.org"
description: |
Monero is a private, secure, untraceable, decentralised digital currency.
You are your bank, you control your funds, and nobody can trace your transfers
unless you allow them to do so.
grade: devel
confinement: strict
apps:
d:
daemon: forking
command: daemon.bash
plugs:
- network
- network-bind
log:
command: log.bash
monero:
command: wallet.bash
plugs:
- network
parts:
wrapper:
plugin: dump
source: .
stage-packages:
- rlwrap
organize:
contrib/snap/daemon.bash: daemon.bash
contrib/snap/log.bash: log.bash
contrib/snap/wallet.bash: wallet.bash
snap:
- daemon.bash
- log.bash
- wallet.bash
- usr/bin/rlwrap
cmake-build:
plugin: cmake
source: .
build-packages:
- gcc
- cmake
- pkg-config
- libunbound-dev
- libevent-dev
- libboost-all-dev
- libdb-dev
- libunwind-dev
- libminiupnpc-dev
- libldns-dev
- libexpat1-dev
- bison
- doxygen
- graphviz
snap:
- bin

View file

@ -106,3 +106,4 @@ add_dependencies(daemon version)
set_property(TARGET daemon set_property(TARGET daemon
PROPERTY PROPERTY
OUTPUT_NAME "monerod") OUTPUT_NAME "monerod")
install(TARGETS daemon DESTINATION bin)

View file

@ -60,3 +60,4 @@ add_dependencies(simplewallet
set_property(TARGET simplewallet set_property(TARGET simplewallet
PROPERTY PROPERTY
OUTPUT_NAME "monero-wallet-cli") OUTPUT_NAME "monero-wallet-cli")
install(TARGETS simplewallet DESTINATION bin)