From 0a56d83d3d8d6369b350ec2810752b683a4a1a3e Mon Sep 17 00:00:00 2001 From: Casey Marshall Date: Thu, 1 Sep 2016 14:23:36 -0500 Subject: [PATCH 1/3] 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. --- contrib/snap/daemon.bash | 11 ++++++ contrib/snap/log.bash | 3 ++ contrib/snap/wallet.bash | 6 ++++ snapcraft.yaml | 62 +++++++++++++++++++++++++++++++++ src/daemon/CMakeLists.txt | 1 + src/simplewallet/CMakeLists.txt | 3 +- 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100755 contrib/snap/daemon.bash create mode 100755 contrib/snap/log.bash create mode 100755 contrib/snap/wallet.bash create mode 100644 snapcraft.yaml diff --git a/contrib/snap/daemon.bash b/contrib/snap/daemon.bash new file mode 100755 index 00000000..dfbf5e3f --- /dev/null +++ b/contrib/snap/daemon.bash @@ -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 diff --git a/contrib/snap/log.bash b/contrib/snap/log.bash new file mode 100755 index 00000000..c81efeb2 --- /dev/null +++ b/contrib/snap/log.bash @@ -0,0 +1,3 @@ +#!/bin/bash -e + +exec tail -c +0 -F ${SNAP_DATA}/.bitmonero/bitmonero.log diff --git a/contrib/snap/wallet.bash b/contrib/snap/wallet.bash new file mode 100755 index 00000000..04aa6c52 --- /dev/null +++ b/contrib/snap/wallet.bash @@ -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 "$@" diff --git a/snapcraft.yaml b/snapcraft.yaml new file mode 100644 index 00000000..89004f62 --- /dev/null +++ b/snapcraft.yaml @@ -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 diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt index 511efcb3..a8c93aa0 100644 --- a/src/daemon/CMakeLists.txt +++ b/src/daemon/CMakeLists.txt @@ -106,3 +106,4 @@ add_dependencies(daemon version) set_property(TARGET daemon PROPERTY OUTPUT_NAME "monerod") +install(TARGETS daemon DESTINATION bin) diff --git a/src/simplewallet/CMakeLists.txt b/src/simplewallet/CMakeLists.txt index 97852c3d..57281989 100644 --- a/src/simplewallet/CMakeLists.txt +++ b/src/simplewallet/CMakeLists.txt @@ -59,4 +59,5 @@ add_dependencies(simplewallet version) set_property(TARGET simplewallet PROPERTY - OUTPUT_NAME "monero-wallet-cli") \ No newline at end of file + OUTPUT_NAME "monero-wallet-cli") +install(TARGETS simplewallet DESTINATION bin) From 823843eadb38ab84cac55d260c9394565af2a3dd Mon Sep 17 00:00:00 2001 From: Casey Marshall Date: Sun, 11 Sep 2016 18:14:38 -0500 Subject: [PATCH 2/3] Fix portability issues discovered with fresh snap install. ARCH=native fixes SIGILL issues on other amd64 processors. Static library dependencies where supported. Package libunbound2 in the snap. --- contrib/snap/daemon.bash | 1 + contrib/snap/wallet.bash | 1 + snapcraft.yaml | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/contrib/snap/daemon.bash b/contrib/snap/daemon.bash index dfbf5e3f..41d1275d 100755 --- a/contrib/snap/daemon.bash +++ b/contrib/snap/daemon.bash @@ -1,5 +1,6 @@ #!/bin/bash -e +export LD_LIBRARY_PATH=${SNAP_LIBRARY_PATH}:${SNAP}/usr/lib/x86_64-linux-gnu export HOME=${SNAP_DATA} cd ${SNAP_DATA} diff --git a/contrib/snap/wallet.bash b/contrib/snap/wallet.bash index 04aa6c52..004f1371 100755 --- a/contrib/snap/wallet.bash +++ b/contrib/snap/wallet.bash @@ -1,5 +1,6 @@ #!/bin/bash -e +export LD_LIBRARY_PATH=${SNAP_LIBRARY_PATH}:${SNAP}/usr/lib/x86_64-linux-gnu export HOME=${SNAP_USER_DATA} cd ${SNAP_USER_DATA} diff --git a/snapcraft.yaml b/snapcraft.yaml index 89004f62..20378941 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -42,6 +42,12 @@ parts: cmake-build: plugin: cmake + configflags: + - -DBDB_STATIC=1 + - -DUPNP_STATIC=1 + - -DBoost_USE_STATIC_LIBS=1 + - -DBoost_USE_STATIC_RUNTIME=1 + - -DARCH=default source: . build-packages: - gcc @@ -58,5 +64,8 @@ parts: - bison - doxygen - graphviz + stage-packages: + - libunbound2 snap: - bin + - usr From a5af33d33b3bcb7c133f8280b8f15b3b2a78c266 Mon Sep 17 00:00:00 2001 From: Casey Marshall Date: Sun, 11 Sep 2016 21:54:43 -0500 Subject: [PATCH 3/3] Add libminiupnpc and libunwind to snap. --- snapcraft.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/snapcraft.yaml b/snapcraft.yaml index 20378941..2ad7ad60 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -65,7 +65,9 @@ parts: - doxygen - graphviz stage-packages: + - libminiupnpc10 - libunbound2 + - libunwind8 snap: - bin - usr