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

Conversation

stkw0
Copy link
Contributor

@stkw0 stkw0 commented Jul 14, 2018

Closes: https://bugs.gentoo.org/643634

Original PR was closed because of the github incident.

@gentoo-bot
Copy link

Pull Request assignment

Areas affected: ebuilds
Packages affected: net-p2p/go-ipfs-bin

net-p2p/go-ipfs-bin: @stkw0, @gentoo/proxy-maint

Bugs linked: 643634

In order to force reassignment and/or bug reference scan, please append [please reassign] to the pull request title.

@gentoo-bot gentoo-bot added self-maintained The PR changes only packages that are maintained by the submitter (i.e. no need to ask anybody else) assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR. labels Jul 14, 2018
@stkw0 stkw0 force-pushed the ipfs branch 2 times, most recently from 4a07880 to 9a7758b Compare July 15, 2018 09:45
need net
}

start() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using the various openrc variables instead of caling start-stop-daemon directly (possibly leaving out start() and stop(). A nice example: https://github.com/gentoo/gentoo/blob/master/dev-db/redis/files/redis.initd-5

command="/usr/bin/ipfs"
command_args="daemon --enable-gc --migrate"
command_user="ipfs:ipfs"
start_stop_daemon_args="--wait 1000 -b -e IPFS_PATH=${IPFS_PATH} \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused. Do you really need to explicitly make openrc pass this over? Wouldn't it be enough to export it in here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? When openrc export something it's also visible to to the service without the need of the -e option?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't test it in detail but AFAIU the mechanics of it, I don't see why it wouldn't be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw some services was using it, so just in case I did the same. There were not any special reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, have you tested that it works without it? ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I forgot the export keyword. At first I didn't deleted the default path and I thought it was working. Sorry :P

@stkw0 stkw0 force-pushed the ipfs branch 2 times, most recently from ccb44e0 to 13d028b Compare July 29, 2018 20:09
newconfd "${FILESDIR}/ipfs.confd" ipfs

keepdir /var/log/ipfs
fowners -R ipfs:ipfs /var/log/ipfs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>>> Install go-ipfs-bin-0.4.15 into /tmp/portage/net-p2p/go-ipfs-bin-0.4.15/image/ category net-p2p
chown: invalid user: ‘ipfs:ipfs’

In other words, you're creating the user after this. Also, please use diropts instead of fowners post creation.

You have two options:

  1. Cheaper: create the user in pkg_setup.
  2. Smarter: forget the above about diropts, create the user and do fowners in pkg_preinst. Then the user won't be needed when building a binary package but will be present for install.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second option seems also more nice :)

Copy link
Member

@mgorny mgorny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this is a major enough change to deserve a revbump.

enewgroup ipfs
enewuser ipfs "" "" /var/lib/ipfs ipfs

elog 'To be able to use the ipfs service you will need to create the ipfs repository'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still belongs in postinst.

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.'

keepdir /var/log/ipfs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keepdir stays in install, only fowners needs to move.

@gentoo-repo-qa-bot
Copy link
Collaborator

Pull request CI report

Report generated at: 2018-08-07 15:01 UTC
Newest commit scanned: 2e9076e
Status: ✅ good

No issues found

@mgorny
Copy link
Member

mgorny commented Aug 7, 2018

Thanks!

@gentoo-bot gentoo-bot closed this in 58150d2 Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned PR successfully assigned to the package maintainer(s). bug linked Bug/Closes found in footer, and cross-linked with the PR. self-maintained The PR changes only packages that are maintained by the submitter (i.e. no need to ask anybody else)
Projects
None yet
5 participants