net-p2p/go-ipfs: new package
authorDavid Roman <davidroman96@gmail.com>
Tue, 9 Jul 2019 20:58:31 +0000 (22:58 +0200)
committerJoonas Niilola <juippis@gentoo.org>
Thu, 13 Feb 2020 06:26:31 +0000 (08:26 +0200)
non binary version of go-ipfs-bin

Package-Manager: Portage-2.3.68, Repoman-2.3.16
Signed-off-by: David Roman <davidroman96@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/12412
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
net-p2p/go-ipfs/Manifest [new file with mode: 0644]
net-p2p/go-ipfs/files/ipfs-at.service [new file with mode: 0644]
net-p2p/go-ipfs/files/ipfs.confd [new file with mode: 0644]
net-p2p/go-ipfs/files/ipfs.init [new file with mode: 0644]
net-p2p/go-ipfs/files/ipfs.service [new file with mode: 0644]
net-p2p/go-ipfs/go-ipfs-0.4.23.ebuild [new file with mode: 0644]
net-p2p/go-ipfs/metadata.xml [new file with mode: 0644]

diff --git a/net-p2p/go-ipfs/Manifest b/net-p2p/go-ipfs/Manifest
new file mode 100644 (file)
index 0000000..7389951
--- /dev/null
@@ -0,0 +1,2 @@
+DIST go-ipfs-0.4.23.bash 20753 BLAKE2B c34d29a48cf249b7a646a8a7b6015b9c4a4a5d8656187ec5984b0dfb741a8ca7b2f2d0a10bc0288aa862679c6d52145936b46497936565ba7cdb2ba847fda5b8 SHA512 acd3bdb689964aa5e15965bfea3cd1267f54a2014c05f49f4e536902cbdab3e22038f4f5db5ecc273c147135b265fcb82a41db22bfc3fd8f6ddc8ae43fd053ea
+DIST go-ipfs-0.4.23.tar.gz 9415138 BLAKE2B 20f9aa246e2170fd8438fbb98ee92a4b1657f1d3e059530cc8e0a1d98a84ea7bdf5de97980f7b345110bcdbd7ed999a5d814c12eaa051aecc28d2d0a47f88272 SHA512 d87513392336fc537bf9c8578d34d650482001c37c1636d64f68fe5d5291c21990c72286c26f43cb6bc2c9c9df14bae69996b60ad6744f335276d52b0cb6978e
diff --git a/net-p2p/go-ipfs/files/ipfs-at.service b/net-p2p/go-ipfs/files/ipfs-at.service
new file mode 100644 (file)
index 0000000..c9ce912
--- /dev/null
@@ -0,0 +1,18 @@
+[Unit]
+Description=InterPlanetary File System
+After=network.target
+
+[Service]
+CPUSchedulingPolicy=batch
+Environment=IPFS_PATH=
+ExecStart=/usr/bin/ipfs daemon --enable-gc --migrate
+ExecStop=/usr/bin/ipfs shutdown
+LimitNOFILE=8192
+PrivateTmp=yes
+ProtectSystem=full
+Restart=on-failure
+Type=simple
+User=%i
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-p2p/go-ipfs/files/ipfs.confd b/net-p2p/go-ipfs/files/ipfs.confd
new file mode 100644 (file)
index 0000000..f1e8eb7
--- /dev/null
@@ -0,0 +1 @@
+IPFS_PATH=/var/lib/ipfs/.ipfs
diff --git a/net-p2p/go-ipfs/files/ipfs.init b/net-p2p/go-ipfs/files/ipfs.init
new file mode 100644 (file)
index 0000000..52f48c5
--- /dev/null
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+# Copyright 1999-2020 Gentoo Authors
+# 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/files/ipfs.service b/net-p2p/go-ipfs/files/ipfs.service
new file mode 100644 (file)
index 0000000..12e9d19
--- /dev/null
@@ -0,0 +1,19 @@
+[Unit]
+Description=InterPlanetary File System
+After=network.target
+
+[Service]
+CPUSchedulingPolicy=batch
+Environment=IPFS_PATH=/var/lib/ipfs/.ipfs
+ExecStart=/usr/bin/ipfs daemon --enable-gc --migrate
+ExecStop=/usr/bin/ipfs shutdown
+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/go-ipfs/go-ipfs-0.4.23.ebuild b/net-p2p/go-ipfs/go-ipfs-0.4.23.ebuild
new file mode 100644 (file)
index 0000000..4b2936e
--- /dev/null
@@ -0,0 +1,69 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit bash-completion-r1 go-module golang-build systemd
+
+DESCRIPTION="Main implementation of IPFS"
+HOMEPAGE="https://ipfs.io/"
+SRC_URI="https://dist.ipfs.io/go-ipfs/v${PV}/go-ipfs-source.tar.gz -> ${P}.tar.gz
+       https://raw.githubusercontent.com/ipfs/go-ipfs/v${PV}/misc/completion/ipfs-completion.bash -> ${P}.bash"
+EGO_PN="github.com/ipfs/go-ipfs"
+
+LICENSE="Apache-2.0 BSD BSD-2 CC0-1.0 ISC MIT MPL-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+       !net-p2p/go-ipfs-bin
+       acct-group/ipfs
+       acct-user/ipfs
+       sys-fs/fuse:0
+"
+
+S="${WORKDIR}"
+
+DOCS=(CHANGELOG.md CONTRIBUTING.md README.md docs/)
+
+src_compile() {
+       local mygoargs=(
+               -v
+               -work
+               -x
+               -tags release
+       )
+
+       go build "${mygoargs[@]}" -o ipfs ${EGO_PN}/cmd/ipfs || die
+       go build "${mygoargs[@]}" -o ipfswatch ${EGO_PN}/cmd/ipfswatch || die
+}
+
+src_test() {
+       go test ${EGO_PN}/cmd/ipfs/... ${EGO_PN}/cmd/ipfswatch/... || die
+}
+
+src_install() {
+       dobin ipfs
+       dobin ipfswatch
+
+       einstalldocs
+
+       systemd_dounit "${FILESDIR}/ipfs.service"
+       systemd_newunit "${FILESDIR}/ipfs-at.service" "ipfs@.service"
+
+       newinitd "${FILESDIR}/ipfs.init" ipfs
+       newconfd "${FILESDIR}/ipfs.confd" ipfs
+
+       newbashcomp "${DISTDIR}/${P}.bash" "ipfs"
+       keepdir /var/log/ipfs
+}
+
+pkg_preinst() {
+       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.'
+}
diff --git a/net-p2p/go-ipfs/metadata.xml b/net-p2p/go-ipfs/metadata.xml
new file mode 100644 (file)
index 0000000..b69fe2e
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="person">
+               <email>davidroman96@gmail.com</email>
+               <name>David Roman</name>
+       </maintainer>
+       <maintainer type="project">
+               <email>proxy-maint@gentoo.org</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+</pkgmetadata>