When other initscripts depend on bitcoind, it’s because their daemons want to be able to invoke bitcoin-cli or to communicate with bitcoind via RPC. That can’t happen until some time after bitcoind has forked into the background. The -startupnotify option was added in 090530cc24 (#15367) to support exactly this use case, so let’s use it.
The ideal OpenRC mechanism of marking the service inactive at startup and later calling back into the start() function with IN_BACKGROUND=yes won’t work here because bitcoind runs as an unprivileged user that is not allowed to call rc-service ${SVCNAME} start, and OpenRC has no mechanism like systemd-notify, so instead we make start-stop-daemon lock a startup dummy file with flock(1) before exec’ing bitcoind, and then we use -startupnotify to release the lock when bitcoind is ready to service RPC requests. In the initscript’s start_post() function we lock the startup file briefly, which forces that function to wait until bitcoind has released its lock on the file, which will happen when bitcoind either executes the -startupnotify command or dies. After acquiring and releasing the lock, start_post() performs one final check that the pid file still exists, which allows the service to be marked as started or stopped appropriately.