Merge #21111: Improve OpenRC initscript

95f97111dd contrib/init: (OpenRC) quote some unquoted variables. (parazyd)
737feadff7 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 (737feadff7) 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 (95f97111dd) simply
  quotes some unquoted variables.

ACKs for top commit:
  kristapsk:
    ACK 95f97111dd

Tree-SHA512: 62bebcd07143c147e349c0cfc17b54ef21bd4684377b444f58c6bd1f509a4d3e1af58746fa7215f18e33021f691bbbc5e42f4df497458322b055e545b7f30d46
pull/826/head
MarcoFalke 4 years ago
commit 3c631917f3
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25

@ -60,16 +60,17 @@ start_pre() {
"${BITCOIND_PIDDIR}" "${BITCOIND_PIDDIR}"
checkpath -f \ checkpath -f \
-o ${BITCOIND_USER}:${BITCOIND_GROUP} \ -o "${BITCOIND_USER}:${BITCOIND_GROUP}" \
-m 0660 \ -m 0660 \
${BITCOIND_CONFIGFILE} "${BITCOIND_CONFIGFILE}"
checkconfig || return 1 checkconfig || return 1
} }
checkconfig() checkconfig()
{ {
if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then if grep -qs '^rpcuser=' "${BITCOIND_CONFIGFILE}" && \
! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then
eerror "" eerror ""
eerror "ERROR: You must set a secure rpcpassword to run bitcoind." eerror "ERROR: You must set a secure rpcpassword to run bitcoind."
eerror "The setting must appear in ${BITCOIND_CONFIGFILE}" eerror "The setting must appear in ${BITCOIND_CONFIGFILE}"

Loading…
Cancel
Save