public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-p2p/go-ipfs-bin/, net-p2p/go-ipfs-bin/files/
Date: Tue,  7 Aug 2018 15:09:55 +0000 (UTC)	[thread overview]
Message-ID: <1533654545.58150d2a90836290517b123f04f2930afd25016b.mgorny@gentoo> (raw)

commit:     58150d2a90836290517b123f04f2930afd25016b
Author:     David Roman <davidroman96 <AT> gmail <DOT> com>
AuthorDate: Thu Jun 14 20:07:46 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Aug  7 15:09:05 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=58150d2a

net-p2p/go-ipfs-bin: add services for openrc & systemd

Closes: https://bugs.gentoo.org/643634
Closes: https://github.com/gentoo/gentoo/pull/9223

 net-p2p/go-ipfs-bin/files/ipfs.confd                 |  1 +
 net-p2p/go-ipfs-bin/files/ipfs.init                  | 17 +++++++++++++++++
 net-p2p/go-ipfs-bin/files/ipfs.service               | 14 ++++++++++++++
 ...in-0.4.15.ebuild => go-ipfs-bin-0.4.15-r1.ebuild} | 20 +++++++++++++++++++-
 4 files changed, 51 insertions(+), 1 deletion(-)

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 00000000000..f1e8eb77adf
--- /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 00000000000..7b38cf43049
--- /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 00000000000..189ace2fd76
--- /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
similarity index 57%
rename from net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.15.ebuild
rename to net-p2p/go-ipfs-bin/go-ipfs-bin-0.4.15-r1.ebuild
index c810e8c42f9..ac644267056 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.'
 }


             reply	other threads:[~2018-08-07 15:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 15:09 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-05-15 18:21 [gentoo-commits] repo/gentoo:master commit in: net-p2p/go-ipfs-bin/, net-p2p/go-ipfs-bin/files/ Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533654545.58150d2a90836290517b123f04f2930afd25016b.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox