2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 13:24:56 +00:00

42_npmjs: do not keep ENV for sudo

git-svn-id: https://svn.fhem.de/fhem/trunk@18800 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2019-03-05 21:05:25 +00:00
parent 42cc5f03c9
commit d2b6308725

View File

@ -835,7 +835,7 @@ sub ExecuteNpmCommand($) {
} }
my $global = '-g '; my $global = '-g ';
my $sudo = 'sudo -n -E '; my $sudo = 'sudo -n ';
if ( $cmd->{npmglobal} eq '0' ) { if ( $cmd->{npmglobal} eq '0' ) {
$global = ''; $global = '';
@ -899,8 +899,8 @@ sub ExecuteNpmCommand($) {
. 'echo n | if [ -z "$(node --version 2>/dev/null)" ]; then' . 'echo n | if [ -z "$(node --version 2>/dev/null)" ]; then'
. ' sh -c "curl -sSL https://deb.nodesource.com/setup_' . ' sh -c "curl -sSL https://deb.nodesource.com/setup_'
. $1 . $1
. '.x | DEBIAN_FRONTEND=noninteractive sudo -n -E bash - >/dev/null 2>&1" 2>&1 &&' . '.x | DEBIAN_FRONTEND=noninteractive sudo -n 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; ' . ' sh -c "DEBIAN_FRONTEND=noninteractive sudo -n apt-get install -qqy nodejs >/dev/null 2>&1" 2>&1; '
. 'fi; ' . 'fi; '
. 'node -e "console.log(JSON.stringify(process.versions));" 2>&1' . 'node -e "console.log(JSON.stringify(process.versions));" 2>&1'
. $cmdSuffix; . $cmdSuffix;
@ -1029,6 +1029,8 @@ sub RetrieveNpmOutput($$) {
my $p = shift; my $p = shift;
my $h = {}; my $h = {};
return $h unless ( defined($p) && $p ne "" );
# first try to interprete text as JSON directly # first try to interprete text as JSON directly
my $decode_json = eval { decode_json($p) }; my $decode_json = eval { decode_json($p) };
if ( not $@ ) { if ( not $@ ) {
@ -1746,7 +1748,7 @@ sub ToDay() {
"node", "node",
"npm" "npm"
], ],
"version": "v1.0.1", "version": "v1.0.3",
"release_status": "stable", "release_status": "stable",
"author": [ "author": [
"Julian Pawlowski <julian.pawlowski@gmail.com>" "Julian Pawlowski <julian.pawlowski@gmail.com>"
@ -1760,9 +1762,9 @@ sub ToDay() {
"prereqs": { "prereqs": {
"runtime": { "runtime": {
"requires": { "requires": {
"FHEM": ">= 5.9.18623", "FHEM": 5.00918623,
"perl": 5.014, "perl": 5.014,
"GPUtils qw(GP_Import)": 0, "GPUtils": 0,
"JSON": 0, "JSON": 0,
"Data::Dumper": 0 "Data::Dumper": 0
}, },
@ -1788,9 +1790,10 @@ sub ToDay() {
"requires": { "requires": {
}, },
"recommends": { "recommends": {
"openssh-client": 0 "curl": 0
}, },
"suggests": { "suggests": {
"openssh-client": 0
} }
} }
}, },
@ -1799,9 +1802,10 @@ sub ToDay() {
"requires": { "requires": {
}, },
"recommends": { "recommends": {
"openssh-client": 0 "curl": 0
}, },
"suggests": { "suggests": {
"openssh-client": 0
} }
} }
}, },
@ -1846,11 +1850,11 @@ sub ToDay() {
}, },
"recommends": { "recommends": {
"ALL=NOPASSWD: /usr/bin/npm update *": 0, "ALL=NOPASSWD: /usr/bin/npm update *": 0,
"ALL=NOPASSWD: /usr/local/bin/npm update *": 0 "ALL=NOPASSWD: /usr/local/bin/npm update *": 0,
"ALL=NOPASSWD: /usr/bin/npm install *": 0,
"ALL=NOPASSWD: /usr/local/bin/npm install *": 0
}, },
"suggests": { "suggests": {
"ALL=NOPASSWD: /usr/bin/npm install *": 0,
"ALL=NOPASSWD: /usr/local/bin/npm install *": 0,
"ALL=NOPASSWD: /usr/bin/npm uninstall *": 0, "ALL=NOPASSWD: /usr/bin/npm uninstall *": 0,
"ALL=NOPASSWD: /usr/local/bin/npm uninstall *": 0 "ALL=NOPASSWD: /usr/local/bin/npm uninstall *": 0
} }