Skip to content

Commit

Permalink
fix: allow server updates when installed in /usr/local (#859)
Browse files Browse the repository at this point in the history
* fix: allow server updates when installed in /usr/local

fixes #857

* refactor: use list npmServerInstallLocations
  • Loading branch information
tkurki committed Sep 8, 2019
2 parents 7177c5b + 3c96c5a commit d75fb89
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/interfaces/appstore.js
Expand Up @@ -20,8 +20,15 @@ const compareVersions = require('compare-versions')
const installModule = require('../modules').installModule
const { findModulesWithKeyword, getLatestServerVersion } = require('../modules')

const npmServerInstallLocations = [
'/usr/bin/signalk-server',
'/usr/lib/node_modules/signalk-server/bin/signalk-server',
'/usr/local/bin/signalk-server',
'/usr/local/lib/node_modules/signalk-server/bin/signalk-server'
]

module.exports = function (app) {
let moduleInstalling = undefined
let moduleInstalling
const modulesInstalledSinceStartup = {}
const moduleInstallQueue = []

Expand Down Expand Up @@ -122,10 +129,8 @@ module.exports = function (app) {
}

if (
process.argv.length > 0 &&
(process.argv[1] === '/usr/bin/signalk-server' ||
process.argv[1] ===
'/usr/lib/node_modules/signalk-server/bin/signalk-server') &&
process.argv.length > 1 &&
npmServerInstallLocations.includes(process.argv[1]) &&
!process.env.SIGNALK_DISABLE_SERVER_UPDATES
) {
all.canUpdateServer = true
Expand Down

0 comments on commit d75fb89

Please sign in to comment.