feat: add script to update nodes

This commit is contained in:
José Oliveira 2021-09-07 23:21:25 +01:00
parent 8128f05ffb
commit 84256bce6c
8 changed files with 171 additions and 10 deletions

View file

@ -4,11 +4,30 @@ const { utils: coinUtils } = require('lamassu-coins')
const common = require('./common')
module.exports = {setup}
module.exports = { setup, updateCore }
const es = common.es
const logger = common.logger
function updateCore (coinRec, isCurrentlyRunning) {
common.logger.info('Updating your Zcash wallet. This may take a minute...')
if (isCurrentlyRunning) common.es(`sudo supervisorctl stop zcash`)
common.es(`curl -#Lo /tmp/zcash.tar.gz ${coinRec.url}`)
common.es(`tar -xzf /tmp/zcash.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/zcash.tar.gz`)
if (isCurrentlyRunning) {
common.logger.info('Starting wallet...')
common.es(`sudo supervisorctl start zcash`)
}
common.logger.info('Zcash is updated!')
}
function setup (dataDir) {
es('sudo apt-get update')
es('sudo apt-get install libgomp1 -y')