commit:     68f11a1a711fe0c4a93565e10004708772fbb252
Author:     Tony Olagbaiye <bqv <AT> fron <DOT> io>
AuthorDate: Sat May 28 03:40:43 2022 +0000
Commit:     Tony Olagbaiye <gentoo <AT> fron <DOT> io>
CommitDate: Sat May 28 03:40:43 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=68f11a1a

net-p2p/ipfs-cluster: add services

Signed-off-by: Tony Olagbaiye <bqv <AT> fron.io>

 net-p2p/ipfs-cluster/files/ipfs-cluster.init    | 21 +++++++++++++++++++++
 net-p2p/ipfs-cluster/files/ipfs-cluster.service | 18 ++++++++++++++++++
 net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild  | 13 +++++++++----
 3 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/net-p2p/ipfs-cluster/files/ipfs-cluster.init 
b/net-p2p/ipfs-cluster/files/ipfs-cluster.init
new file mode 100644
index 000000000..11a5bc62e
--- /dev/null
+++ b/net-p2p/ipfs-cluster/files/ipfs-cluster.init
@@ -0,0 +1,21 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+source /etc/conf.d/ipfs
+
+export IPFS_PATH=${IPFS_PATH:-/var/lib/ipfs/.ipfs}
+
+pidfile="/run/ipfs-cluster.pid"
+command="/usr/bin/ipfs-cluster-service"
+command_args="daemon"
+command_user="ipfs:ipfs"
+command_background=true
+start_stop_daemon_args="--wait 1000 -b -m \
+                        -1 /var/log/ipfs/ipfs-cluster.log \
+                        -2 /var/log/ipfs/ipfs-cluster.log"
+
+depend() {
+       need net
+       want ipfs
+}

diff --git a/net-p2p/ipfs-cluster/files/ipfs-cluster.service 
b/net-p2p/ipfs-cluster/files/ipfs-cluster.service
new file mode 100644
index 000000000..31576a3f9
--- /dev/null
+++ b/net-p2p/ipfs-cluster/files/ipfs-cluster.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=IPFS Cluster
+After=ipfs.service
+
+[Service]
+CPUSchedulingPolicy=batch
+Environment=IPFS_PATH=/var/lib/ipfs/.ipfs
+ExecStart=/usr/bin/ipfs-cluster-service daemon
+Group=ipfs
+LimitNOFILE=8192
+PrivateTmp=yes
+ProtectSystem=full
+Restart=on-failure
+Type=simple
+User=ipfs
+
+[Install]
+WantedBy=multi-user.target

diff --git a/net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild 
b/net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild
index 455b766b7..7e0c64e89 100644
--- a/net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild
+++ b/net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild
@@ -47,12 +47,17 @@ src_install() {
        dobin ipfs-cluster-service
        einstalldocs
 
-       #systemd_dounit "${FILESDIR}/ipfs-cluster-service.service"
-       #systemd_newunit "${FILESDIR}/ipfs-cluster-service.service" 
"[email protected]"
+       systemd_dounit "${FILESDIR}/ipfs-cluster.service"
+       systemd_newunit "${FILESDIR}/ipfs-cluster.service" 
"[email protected]"
 
-       #newinitd "${FILESDIR}/ipfs-cluster-service.init" ipfs
-       #newconfd "${FILESDIR}/ipfs-cluster-service.confd" ipfs
+       newinitd "${FILESDIR}/ipfs-cluster.init" ipfs-cluster
+       newconfd /dev/null ipfs-cluster
 
        keepdir /var/log/ipfs-cluster
        fowners -R ipfs:ipfs /var/log/ipfs-cluster
 }
+
+pkg_postinst() {
+       elog 'To be able to use the ipfs-cluster service you will need to setup 
the configuration'
+       elog '(eg: su -s /bin/sh -c "ipfs-cluster init" ipfs)'
+}

Reply via email to