From 4a71c783bd70d6e59d4f92d31776c6cb5117ae97 Mon Sep 17 00:00:00 2001 From: jpawlowski Date: Fri, 22 Feb 2019 14:17:05 +0000 Subject: [PATCH] 42_npmjs: separate statusRequest setter from install setter git-svn-id: https://svn.fhem.de/fhem/trunk@18689 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/42_npmjs.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/42_npmjs.pm b/fhem/FHEM/42_npmjs.pm index 40715502c..f8758377c 100644 --- a/fhem/FHEM/42_npmjs.pm +++ b/fhem/FHEM/42_npmjs.pm @@ -268,6 +268,9 @@ sub Set($$@) { if ( $cmd eq 'outdated' ) { $hash->{".fhem"}{npm}{cmd} = $cmd; } + elsif ( lc($cmd) eq 'statusrequest' ) { + $hash->{".fhem"}{npm}{cmd} = 'getNodeVersion'; + } elsif ( $cmd eq 'update' ) { if ( defined( $args[0] ) and ( lc( $args[0] ) eq "fhem-all" ) ) { return "Please run outdated check first" @@ -363,7 +366,7 @@ sub Set($$@) { if ( !defined( $hash->{".fhem"}{npm}{nodejsversions} ) ) { $list = - "install:nodejs-v11,nodejs-v10,nodejs-v8,nodejs-v6,statusRequest"; +"install:nodejs-v11,nodejs-v10,nodejs-v8,nodejs-v6 statusRequest:noArg"; } else { $list = "outdated:noArg"; @@ -811,14 +814,13 @@ sub ExecuteNpmCommand($) { if ( not defined( $cmd->{nodejsversions} ) or not defined( $cmd->{nodejsversions}{node} ) ) { - if ( lc($1) eq "statusrequest" ) { - $npm->{npminstall} = $npm->{nodejsversions}; - } - elsif ( $1 =~ /^nodejs-v(\d+)/ ) { + if ( $1 =~ /^nodejs-v(\d+)/ ) { $npm->{npminstall} = $cmdPrefix . 'echo n | if [ -z "$(node --version 2>/dev/null)" ]; then' - . ' sh -c "curl -sSL https://deb.nodesource.com/setup_'.$1.'.x | DEBIAN_FRONTEND=noninteractive sudo -n -E bash - >/dev/null 2>&1" 2>&1 &&' + . ' sh -c "curl -sSL https://deb.nodesource.com/setup_' + . $1 + . '.x | DEBIAN_FRONTEND=noninteractive sudo -n -E bash - >/dev/null 2>&1" 2>&1 &&' . ' sh -c "DEBIAN_FRONTEND=noninteractive sudo -n -E apt-get install -qqy nodejs >/dev/null 2>&1" 2>&1; ' . 'fi; ' . 'node -e "console.log(JSON.stringify(process.versions));" 2>&1' @@ -1488,6 +1490,8 @@ sub ToDay() {
Set