Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions net-p2p/go-ipfs-bin/files/ipfs.confd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IPFS_PATH=/var/lib/ipfs/.ipfs
17 changes: 17 additions & 0 deletions net-p2p/go-ipfs-bin/files/ipfs.init
Original file line number Diff line number Diff line change
@@ -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
}
14 changes: 14 additions & 0 deletions net-p2p/go-ipfs-bin/files/ipfs.service
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand All @@ -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.'
}