feat: backport l-c script to install btcd v20 as default and then update to latest

This commit is contained in:
José Oliveira 2021-11-02 21:58:57 +00:00
parent 2e1564c23c
commit adb9be23d6
3 changed files with 48 additions and 6 deletions

View file

@ -4,7 +4,7 @@ const coinUtils = require('../coin-utils')
const common = require('./common')
module.exports = {setup}
module.exports = { setup, updateCore }
const coinRec = coinUtils.getCryptoCurrency('BTC')
@ -16,6 +16,23 @@ function setup (dataDir) {
common.writeSupervisorConfig(coinRec, cmd)
}
function updateCore (coinRec) {
common.logger.info('Updating Bitcoin Core. This may take a minute.')
common.es(`sudo supervisorctl stop bitcoin`)
common.es(`curl -#o /tmp/bitcoin.tar.gz ${coinRec.url}`)
common.es(`tar -xzf /tmp/bitcoin.tar.gz -C /tmp/`)
common.logger.info('Updating wallet...')
common.es(`cp /tmp/${coinRec.dir}/* /usr/local/bin/`)
common.es(`rm -r /tmp/${coinRec.dir.replace('/bin', '')}`)
common.es(`rm /tmp/bitcoin.tar.gz`)
common.logger.info('Starting wallet...')
common.es(`sudo supervisorctl start bitcoin`)
common.logger.info('Bitcoin Core is updated!')
}
function buildConfig () {
return `rpcuser=lamassuserver
rpcpassword=${common.randomPass()}