From 5cf4ee292a6160467a1daf2fc1f8bf08682b7ebc Mon Sep 17 00:00:00 2001 From: Josh Harvey Date: Wed, 12 Jul 2017 17:16:11 +0300 Subject: [PATCH] fix coin install bugs --- lib/blockchain/common.js | 3 ++- lib/blockchain/install.js | 4 ++-- lib/coin-utils.js | 6 +----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/blockchain/common.js b/lib/blockchain/common.js index 60972928..d92c4271 100644 --- a/lib/blockchain/common.js +++ b/lib/blockchain/common.js @@ -63,7 +63,7 @@ function writeSupervisorConfig (coinRec, cmd) { const blockchain = coinRec.code const supervisorConfig = `[program:${blockchain}] -command=${cmd} +command=nice ${cmd} autostart=true autorestart=true stderr_logfile=/var/log/supervisor/${blockchain}.err.log @@ -99,6 +99,7 @@ function writeFile (path, content) { } catch (err) { if (err.code === 'EEXIST') { logger.info(`${path} exists, skipping.`) + return } throw err diff --git a/lib/blockchain/install.js b/lib/blockchain/install.js index 106e2ffd..15eff08a 100644 --- a/lib/blockchain/install.js +++ b/lib/blockchain/install.js @@ -60,7 +60,7 @@ function processCryptos (codes) { function setupCrypto (crypto) { logger.info(`Installing ${crypto.display}...`) - const cryptoDir = coinUtils.cryptoConfigDir(crypto) + const cryptoDir = coinUtils.cryptoDir(crypto) makeDir.sync(cryptoDir) const cryptoPlugin = plugin(crypto) const oldDir = process.cwd() @@ -85,7 +85,7 @@ function plugin (crypto) { function run () { const choices = _.map(c => { - const checked = isInstalledSoftware(c) && isInstalledVolume() + const checked = isInstalledSoftware(c) && isInstalledVolume(c) return { name: c.display, value: c.code, diff --git a/lib/coin-utils.js b/lib/coin-utils.js index 51800e62..0468d8b1 100644 --- a/lib/coin-utils.js +++ b/lib/coin-utils.js @@ -52,7 +52,7 @@ const CRYPTO_CURRENCIES = [ } ] -module.exports = {buildUrl, cryptoDir, cryptoConfigDir, cryptoCurrencies, getCryptoCurrency} +module.exports = {buildUrl, cryptoDir, cryptoCurrencies, getCryptoCurrency} function getCryptoCurrency (cryptoCode) { const cryptoCurrency = _.find(['cryptoCode', cryptoCode], CRYPTO_CURRENCIES) @@ -81,7 +81,3 @@ function cryptoDir (cryptoRec) { return path.resolve(blockchainDir, code) } -function cryptoConfigDir (cryptoRec) { - const configFile = cryptoRec.configFile - return path.resolve(cryptoDir(cryptoRec), configFile) -}