From 720dd8c4d147393ec2fafb19c672c3a611ff7e22 Mon Sep 17 00:00:00 2001 From: e-sailing Date: Fri, 3 Jan 2020 23:50:14 +0100 Subject: [PATCH] Update signalkPostInstall.py node_modules isn't a fixed to one path --- openplotterSignalkInstaller/signalkPostInstall.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openplotterSignalkInstaller/signalkPostInstall.py b/openplotterSignalkInstaller/signalkPostInstall.py index 5572ca0..9ff4e1f 100644 --- a/openplotterSignalkInstaller/signalkPostInstall.py +++ b/openplotterSignalkInstaller/signalkPostInstall.py @@ -22,7 +22,7 @@ def main(): conf2 = conf.Conf() - currentdir = os.path.dirname(__file__) + currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir,'openplotter-signalk-installer',currentLanguage) platform2 = platform.Platform() @@ -59,8 +59,14 @@ def main(): fo.write( '{"interfaces": {},"ssl": false,"pipedProviders": [],"security": {"strategy": "./tokensecurity"}}') fo.close() + node_path_all = subprocess.check_output(['npm', 'config', 'get', 'prefix']).decode(sys.stdin.encoding) + node_path_line = node_path_all.split('\n') + node_path = '/usr' + if node_path_line.length > 0: + node_path = node_path_line[node_path_line.length - 1] + fo = open(skDir+'/signalk-server', "w") - fo.write( '#!/bin/sh\n/usr/lib/node_modules/signalk-server/bin/signalk-server -c '+skDir+' $*\n') + fo.write( '#!/bin/sh\n'+node_path+'/lib/node_modules/signalk-server/bin/signalk-server -c '+skDir+' $*\n') fo.close() subprocess.call(['chown', '-R', conf2.user+':'+conf2.user, skDir])