Gentoo Archives: gentoo-commits

From: Tony Olagbaiye <gentoo@××××.io>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: net-p2p/ipfs-cluster/, net-p2p/ipfs-cluster/files/
Date: Sat, 28 May 2022 03:41:35
Message-Id: 1653709243.68f11a1a711fe0c4a93565e10004708772fbb252.gentoo@gentoo
1 commit: 68f11a1a711fe0c4a93565e10004708772fbb252
2 Author: Tony Olagbaiye <bqv <AT> fron <DOT> io>
3 AuthorDate: Sat May 28 03:40:43 2022 +0000
4 Commit: Tony Olagbaiye <gentoo <AT> fron <DOT> io>
5 CommitDate: Sat May 28 03:40:43 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=68f11a1a
7
8 net-p2p/ipfs-cluster: add services
9
10 Signed-off-by: Tony Olagbaiye <bqv <AT> fron.io>
11
12 net-p2p/ipfs-cluster/files/ipfs-cluster.init | 21 +++++++++++++++++++++
13 net-p2p/ipfs-cluster/files/ipfs-cluster.service | 18 ++++++++++++++++++
14 net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild | 13 +++++++++----
15 3 files changed, 48 insertions(+), 4 deletions(-)
16
17 diff --git a/net-p2p/ipfs-cluster/files/ipfs-cluster.init b/net-p2p/ipfs-cluster/files/ipfs-cluster.init
18 new file mode 100644
19 index 000000000..11a5bc62e
20 --- /dev/null
21 +++ b/net-p2p/ipfs-cluster/files/ipfs-cluster.init
22 @@ -0,0 +1,21 @@
23 +#!/sbin/openrc-run
24 +# Copyright 1999-2021 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +source /etc/conf.d/ipfs
28 +
29 +export IPFS_PATH=${IPFS_PATH:-/var/lib/ipfs/.ipfs}
30 +
31 +pidfile="/run/ipfs-cluster.pid"
32 +command="/usr/bin/ipfs-cluster-service"
33 +command_args="daemon"
34 +command_user="ipfs:ipfs"
35 +command_background=true
36 +start_stop_daemon_args="--wait 1000 -b -m \
37 + -1 /var/log/ipfs/ipfs-cluster.log \
38 + -2 /var/log/ipfs/ipfs-cluster.log"
39 +
40 +depend() {
41 + need net
42 + want ipfs
43 +}
44
45 diff --git a/net-p2p/ipfs-cluster/files/ipfs-cluster.service b/net-p2p/ipfs-cluster/files/ipfs-cluster.service
46 new file mode 100644
47 index 000000000..31576a3f9
48 --- /dev/null
49 +++ b/net-p2p/ipfs-cluster/files/ipfs-cluster.service
50 @@ -0,0 +1,18 @@
51 +[Unit]
52 +Description=IPFS Cluster
53 +After=ipfs.service
54 +
55 +[Service]
56 +CPUSchedulingPolicy=batch
57 +Environment=IPFS_PATH=/var/lib/ipfs/.ipfs
58 +ExecStart=/usr/bin/ipfs-cluster-service daemon
59 +Group=ipfs
60 +LimitNOFILE=8192
61 +PrivateTmp=yes
62 +ProtectSystem=full
63 +Restart=on-failure
64 +Type=simple
65 +User=ipfs
66 +
67 +[Install]
68 +WantedBy=multi-user.target
69
70 diff --git a/net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild b/net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild
71 index 455b766b7..7e0c64e89 100644
72 --- a/net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild
73 +++ b/net-p2p/ipfs-cluster/ipfs-cluster-1.0.1.ebuild
74 @@ -47,12 +47,17 @@ src_install() {
75 dobin ipfs-cluster-service
76 einstalldocs
77
78 - #systemd_dounit "${FILESDIR}/ipfs-cluster-service.service"
79 - #systemd_newunit "${FILESDIR}/ipfs-cluster-service.service" "ipfs-cluster-service@.service"
80 + systemd_dounit "${FILESDIR}/ipfs-cluster.service"
81 + systemd_newunit "${FILESDIR}/ipfs-cluster.service" "ipfs-cluster@.service"
82
83 - #newinitd "${FILESDIR}/ipfs-cluster-service.init" ipfs
84 - #newconfd "${FILESDIR}/ipfs-cluster-service.confd" ipfs
85 + newinitd "${FILESDIR}/ipfs-cluster.init" ipfs-cluster
86 + newconfd /dev/null ipfs-cluster
87
88 keepdir /var/log/ipfs-cluster
89 fowners -R ipfs:ipfs /var/log/ipfs-cluster
90 }
91 +
92 +pkg_postinst() {
93 + elog 'To be able to use the ipfs-cluster service you will need to setup the configuration'
94 + elog '(eg: su -s /bin/sh -c "ipfs-cluster init" ipfs)'
95 +}