summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.'
}