Merge #21111: Improve OpenRC initscript

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

ACKs for top commit:
  kristapsk:
    ACK 95f97111dd27f32dfcb461c9dd6890aa8d1355ed

Tree-SHA512: 62bebcd07143c147e349c0cfc17b54ef21bd4684377b444f58c6bd1f509a4d3e1af58746fa7215f18e33021f691bbbc5e42f4df497458322b055e545b7f30d46
This commit is contained in:
MarcoFalke 2021-03-13 18:52:32 +01:00 committed by pasta
parent a9c314feba
commit e07e289e0a

View File

@ -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 dashd."
eerror "The setting must appear in ${BITCOIND_CONFIGFILE}"