From 0025a416b1b148a09336d5d16ad2ff8cc4b0c0d1 Mon Sep 17 00:00:00 2001 From: jpawlowski Date: Sat, 4 Jan 2020 13:41:49 +0000 Subject: [PATCH] 42_npmjs: update to v1.1.4 git-svn-id: https://svn.fhem.de/fhem/trunk@20878 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/42_npmjs.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fhem/FHEM/42_npmjs.pm b/fhem/FHEM/42_npmjs.pm index 5701dcd1b..201d574b6 100644 --- a/fhem/FHEM/42_npmjs.pm +++ b/fhem/FHEM/42_npmjs.pm @@ -922,6 +922,7 @@ sub ExecuteNpmCommand($) { $npm->{npminstall} = $cmdPrefix . 'echo n | sh -c "' + . $locale . $sudo . $locale . ' NODE_ENV=${NODE_ENV:-production} npm install ' @@ -931,6 +932,7 @@ sub ExecuteNpmCommand($) { $npm->{npmuninstall} = $cmdPrefix . 'echo n | sh -c "' + . $locale . $sudo . $locale . ' NODE_ENV=${NODE_ENV:-production} npm uninstall ' @@ -940,6 +942,7 @@ sub ExecuteNpmCommand($) { $npm->{npmupdate} = $cmdPrefix . 'echo n | sh -c "' + . $locale . $sudo . $locale . ' NODE_ENV=${NODE_ENV:-production} npm update ' @@ -960,6 +963,7 @@ sub ExecuteNpmCommand($) { . '--json --silent --depth=0 2>/dev/null); ' . '[ "$L1" != "" ] && [ "$L1" != "\n" ] && echo ", \"listed\": $L1"; ' . 'L2=$(' + . $locale . $sudo . $locale . ' npm outdated ' @@ -1176,12 +1180,12 @@ sub RetrieveNpmOutput($$) { . "were authorized to access remote host"; $h->{error}{detail} = "
$o
"; } - elsif ( $o =~ m/^sudo: /i ) { + elsif ( $o =~ m/(sudo: .+)/i ) { $h->{error}{code} = "E403"; $h->{error}{summary} = "Forbidden - " . "passwordless sudo permissions required"; $h->{error}{detail} = - $o + $1 . "

" . "You may add the following lines to /etc/sudoers.d/$runningUser:\n" . "
"
@@ -1685,7 +1689,6 @@ sub ToDay() {
   

This line may easily be added to a new file in /etc/sudoers.d/fhem and will automatically included to /etc/sudoers from there.
- Only checking for outdated packages does not require any privileged access at all!


Define
@@ -1776,13 +1779,13 @@ sub ToDay() { Standardmäßig werden globale Installationen bedient und das Ausführen von update/install/uninstall erfordert sudo Berechtigungen wie diese:

+ fhem ALL=(ALL) NOPASSWD:SETENV: /usr/bin/npm outdated *
fhem ALL=(ALL) NOPASSWD:SETENV: /usr/bin/npm update *
fhem ALL=(ALL) NOPASSWD:SETENV: /usr/bin/npm install *
fhem ALL=(ALL) NOPASSWD:SETENV: /usr/bin/npm uninstall *


Diese Zeile kann einfach in einer neuen Datei unter /etc/sudoers.d/fhem hinzugefügt werden und wird von dort automatisch in /etc/sudoers inkludiert.
- Um nur die zu aktualisierenden Pakete zu überprüfen wird überhaupt kein priviligierter Zugriff benötigt!


Define
@@ -1869,7 +1872,7 @@ sub ToDay() { "abstract": "Modul zur Bedienung der Node.js Installation und Updates" } }, - "version": "v1.1.3", + "version": "v1.1.4", "release_status": "stable", "author": [ "Julian Pawlowski " @@ -1934,6 +1937,8 @@ sub ToDay() { "requires": { }, "recommends": { + "ALL=(ALL) NOPASSWD:SETENV: /usr/bin/npm outdated *": 0, + "ALL=(ALL) NOPASSWD:SETENV: /usr/local/bin/npm outdated *": 0, "ALL=(ALL) NOPASSWD:SETENV: /usr/bin/npm update *": 0, "ALL=(ALL) NOPASSWD:SETENV: /usr/local/bin/npm update *": 0, "ALL=(ALL) NOPASSWD:SETENV: /usr/bin/npm install *": 0,