Skip to content

Commit

Permalink
Merge bitcoin#21111: Improve OpenRC initscript
Browse files Browse the repository at this point in the history
95f9711 contrib/init: (OpenRC) quote some unquoted variables. (parazyd)
737fead contrib/init: (OpenRC) Do not fail if both rpcuser and rpcpassword are unset. (parazyd)

Pull request description:

  This pull request improves the available OpenRC initscripts in
  `contrib/init`.

  The first commit (737fead) reworks
  `checkconfig()` to not fail if **both** `rpcuser` and `rpcpassword`
  are unset, because this implies that bitcoind shall use the `.cookie`
  file for RPC authentication. Currently, the initscript does not allow
  starting bitcoind without a set `rpcuser` and `rpcpassword`.

  The second commit (95f9711) simply
  quotes some unquoted variables.

ACKs for top commit:
  kristapsk:
    ACK 95f9711

Tree-SHA512: 62bebcd07143c147e349c0cfc17b54ef21bd4684377b444f58c6bd1f509a4d3e1af58746fa7215f18e33021f691bbbc5e42f4df497458322b055e545b7f30d46
  • Loading branch information
MarcoFalke committed Mar 13, 2021
2 parents e0bc27a + 95f9711 commit 3c63191
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contrib/init/bitcoind.openrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ start_pre() {
"${BITCOIND_PIDDIR}"

checkpath -f \
-o ${BITCOIND_USER}:${BITCOIND_GROUP} \
-o "${BITCOIND_USER}:${BITCOIND_GROUP}" \
-m 0660 \
${BITCOIND_CONFIGFILE}
"${BITCOIND_CONFIGFILE}"

checkconfig || return 1
}

checkconfig()
{
if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
if grep -qs '^rpcuser=' "${BITCOIND_CONFIGFILE}" && \
! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
eerror ""
eerror "ERROR: You must set a secure rpcpassword to run bitcoind."
eerror "The setting must appear in ${BITCOIND_CONFIGFILE}"
Expand Down

0 comments on commit 3c63191

Please sign in to comment.