summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Roman <davidroman96@gmail.com>2018-06-14 22:07:46 +0200
committerMichał Górny <mgorny@gentoo.org>2018-08-07 17:09:05 +0200
commit58150d2a90836290517b123f04f2930afd25016b (patch)
tree200d80a84dfb54886eb5c88bc45901cf566329d8 /net-p2p
parentwww-client/opera: Old. (diff)
downloadgentoo-58150d2a90836290517b123f04f2930afd25016b.tar.gz
gentoo-58150d2a90836290517b123f04f2930afd25016b.tar.bz2
gentoo-58150d2a90836290517b123f04f2930afd25016b.zip
net-p2p/go-ipfs-bin: add services for openrc & systemd
Closes: https://bugs.gentoo.org/643634 Closes: https://github.com/gentoo/gentoo/pull/9223
Diffstat (limited to 'net-p2p')
-rw-r--r--net-p2p/go-ipfs-bin/files/ipfs.confd1
-rw-r--r--net-p2p/go-ipfs-bin/files/ipfs.init17
-rw-r--r--net-p2p/go-ipfs-bin/files/ipfs.service14
-rw-r--r--net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.15-r1.ebuild (renamed from net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.15.ebuild)20
4 files changed, 51 insertions, 1 deletions
diff --git a/net-p2p/go-ipfs-bin/files/ipfs.confd b/net-p2p/go-ipfs-bin/files/ipfs.confd
new file mode 100644
index 000000000000..f1e8eb77adf5
--- /dev/null
+++ b/net-p2p/go-ipfs-bin/files/ipfs.confd
@@ -0,0 +1 @@
+IPFS_PATH=/var/lib/ipfs/.ipfs
diff --git a/net-p2p/go-ipfs-bin/files/ipfs.init b/net-p2p/go-ipfs-bin/files/ipfs.init
new file mode 100644
index 000000000000..7b38cf43049b
--- /dev/null
+++ b/net-p2p/go-ipfs-bin/files/ipfs.init
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+export IPFS_PATH=${IPFS_PATH:-/var/lib/ipfs/.ipfs}
+
+pidfile="/run/ipfs.pid"
+command="/usr/bin/ipfs"
+command_args="daemon --enable-gc --migrate"
+command_user="ipfs:ipfs"
+start_stop_daemon_args="--wait 1000 -b \
+ -1 /var/log/ipfs/ipfs.log \
+ -2 /var/log/ipfs/ipfs.log"
+
+depend() {
+ need net
+}
diff --git a/net-p2p/go-ipfs-bin/files/ipfs.service b/net-p2p/go-ipfs-bin/files/ipfs.service
new file mode 100644
index 000000000000..189ace2fd762
--- /dev/null
+++ b/net-p2p/go-ipfs-bin/files/ipfs.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=InterPlanetary File System
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/ipfs daemon --enable-gc --migrate
+ExecStop=/usr/bin/ipfs shutdown
+Group=%i
+Restart=always
+Type=simple
+User=%i
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.15.ebuild b/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.15-r1.ebuild
index c810e8c42f96..ac6442670566 100644
--- a/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.15.ebuild
+++ b/net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.15-r1.ebuild
@@ -3,7 +3,7 @@
EAPI=6
-inherit bash-completion-r1
+inherit bash-completion-r1 systemd user
DESCRIPTION="Main implementation of IPFS"
HOMEPAGE="https://ipfs.io/"
@@ -25,5 +25,23 @@ QA_PREBUILT="/usr/bin/ipfs"
src_install() {
dobin ipfs
+ systemd_dounit "${FILESDIR}/ipfs.service"
+ newinitd "${FILESDIR}/ipfs.init" ipfs
+ newconfd "${FILESDIR}/ipfs.confd" ipfs
+
newbashcomp "${DISTDIR}/${P}.bash" "ipfs"
+ keepdir /var/log/ipfs
+}
+
+pkg_preinst() {
+ enewgroup ipfs
+ enewuser ipfs "" "" /var/lib/ipfs ipfs
+
+ fowners -R ipfs:ipfs /var/log/ipfs
+}
+
+pkg_postinst() {
+ elog 'To be able to use the ipfs service you will need to create the ipfs repository'
+ elog '(eg: su -s /bin/sh -c "ipfs init -e" ipfs)'
+ elog 'or change IPFS_PATH of /etc/conf.d/ipfs with another with proper permissions.'
}