feat: add script to update nodes
This commit is contained in:
parent
8128f05ffb
commit
84256bce6c
8 changed files with 171 additions and 10 deletions
|
|
@ -4,7 +4,7 @@ const { utils: coinUtils } = require('lamassu-coins')
|
|||
|
||||
const common = require('./common')
|
||||
|
||||
module.exports = {setup}
|
||||
module.exports = { setup, updateCore }
|
||||
|
||||
const coinRec = coinUtils.getCryptoCurrency('BCH')
|
||||
|
||||
|
|
@ -16,6 +16,26 @@ function setup (dataDir) {
|
|||
common.writeSupervisorConfig(coinRec, cmd)
|
||||
}
|
||||
|
||||
function updateCore (coinRec, isCurrentlyRunning) {
|
||||
common.logger.info('Updating Bitcoin Cash. This may take a minute...')
|
||||
if (isCurrentlyRunning) common.es(`sudo supervisorctl stop bitcoincash`)
|
||||
common.es(`curl -#Lo /tmp/bitcoincash.tar.gz ${coinRec.url}`)
|
||||
common.es(`tar -xzf /tmp/bitcoincash.tar.gz -C /tmp/`)
|
||||
|
||||
common.logger.info('Updating wallet...')
|
||||
common.es(`cp /tmp/${coinRec.dir}/bitcoind /usr/local/bin/bitcoincashd`)
|
||||
common.es(`cp /tmp/${coinRec.dir}/bitcoin-cli /usr/local/bin/bitcoincash-cli`)
|
||||
common.es(`rm -r /tmp/${coinRec.dir.replace('/bin', '')}`)
|
||||
common.es(`rm /tmp/bitcoincash.tar.gz`)
|
||||
|
||||
if (isCurrentlyRunning) {
|
||||
common.logger.info('Starting wallet...')
|
||||
common.es(`sudo supervisorctl start bitcoincash`)
|
||||
}
|
||||
|
||||
common.logger.info('Bitcoin Cash is updated!')
|
||||
}
|
||||
|
||||
function buildConfig () {
|
||||
return `rpcuser=lamassuserver
|
||||
rpcpassword=${common.randomPass()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue