Created attachment 177675 [details] combined bitcoin / bitcoin-daemon patches Patch file for: a) net-p2p/bitcoin to fix path error in startup script files/bitcoin.in also removes reliance on unnecessary cli script. b) net-p2p/bitcoin-daemon to create the user/group for the daemon to use also install a sample configuration file. With these two patches a "pkg install bitcoin-daemon" followed by "service start bitcoind" will be sufficient to run as a non-privileged user and automatically connect to bitcoin live network; using /var/db/bitcoin to store blockchain data.
This looks fine. Nice addition to the scripts. I also agree that just a normal kill of the daemon is fine.
I am a bit curious here: 1) Why change data directory to /var/db/bitcoin, is this used as default location in the application? 2) Why directly use `kill ${pid}` but not original stop command in cli?
(In reply to Li-Wen Hsu from comment #2) 1) Why change data directory to /var/db/bitcoin, is this used as default location in the application? Because /var/db is the canonical location for data like this. The default location is inside the user's home directory, which, for a system user like this, should not exist. 2) Why directly use `kill ${pid}` but not original stop command in cli? Because the -cli commands are installed by the separate Bitcoin-cli port, and are not strictly necessary to run the daemon.
(In reply to robbak from comment #3) >> 1) Why change data directory to /var/db/bitcoin, is this used as default >> location in the application? > Because /var/db is the canonical location for data like this. The default location is inside the user's home directory, which, for a system user like this, should not exist. But the patch only rename the directory from /var/db/bitcoind to /var/db/bitcoin, is this a cosmetic change? (That also works, but there are lots of "bitcoin" and "bitcoind" in this file. Do we have a convention about how to use them?) >> 2) Why directly use `kill ${pid}` but not original stop command in cli? > Because the -cli commands are installed by the separate Bitcoin-cli port, and are not strictly necessary to run the daemon. That makes sense.
About bitcoin/bitcoind the default configuration is bitcoin.conf so I was thinking that maybe user/group/datadir should be bitcoin and only the daemon name is bitcoind; does that seem reasonable?
(In reply to Christopher Hall from comment #5) > About bitcoin/bitcoind the default configuration is bitcoin.conf so I was thinking that maybe user/group/datadir should be bitcoin and only the daemon name is bitcoind; does that seem reasonable? I have no preference between them, but please note that if we change this directory, the users who upgrade from old version have original data in /var/db/bitcoind. These data will not be found by the new package. If we are going to do this, we need to have an UPDATING entry to notify users to move data or specify bitcoind_data_dir by themselves. Also, this modification needs bump PORTREVISION.
(In reply to Li-Wen Hsu from comment #6) OK, agree on both points. While /var/db/bitcoin is the best place for it (as the location still makes sense if used with bitcon-qt), if the existing script uses /var/db/bitcoind, then it makes sense to keep it. Also ACK on the portrevision bump.
(In reply to robbak from comment #7) If we believe that /var/db/bitcoin is a better location, just writing an UPDATING entry to notify user is okay. Or we can modify the startup script to provide backward compatibility. I am happy to commit your new patch :-)
(In reply to Li-Wen Hsu from comment #8) Then go for it. This is been sitting in the queue for too long.
A commit references this bug: Author: lwhsu Date: Tue Aug 1 16:45:33 UTC 2017 New revision: 447030 URL: https://svnweb.freebsd.org/changeset/ports/447030 Log: - net-p2p/bitcoin: fix path error in startup script files/bitcoin.in also removes reliance on unnecessary cli script. - net-p2p/bitcoin-daemon: create the user/group for the daemon to use also install a sample configuration file. With these two patches a "pkg install bitcoin-daemon" followed by "service start bitcoind" will be sufficient to run as a non-privileged user and automatically connect to bitcoin live network; using /var/db/bitcoin to store blockchain data. PR: 215059 Submitted by: Christopher Hall <hsw@bitmark.com> Approved by: <robbak@robbak.com> (maintainer) Changes: head/UPDATING head/net-p2p/bitcoin/Makefile head/net-p2p/bitcoin/files/bitcoind.in head/net-p2p/bitcoin-daemon/Makefile