Files
nvm/test/installation_node/install from binary
Dick Marinus 790ffd2682 [Fix] fix same owner for root when install from binary
GNU Tar has `--preserve-permissions` as a default enabled when executed as the superuser (root).
This will cause the binaries to be installed using the permissions (owner and group) as defined in the tarball.

The argument `--no-same-owner` prevents this and will install the binaries as the effective owner/group just like when nvm is executed as a non superuser.

Updated the install from binary test from the installation_node test
suite because this test is run in a docker container as root. Without
--no-same-owner this test will fail beause the binaries of node v0.10.7
are owned by isaacs/admin in the tarball.
2026-05-05 15:40:32 -07:00

26 lines
887 B
Bash
Executable File

#!/bin/sh
die () { echo "$@" ; exit 1; }
\. ../../nvm.sh
nvm unalias default || die 'unable to unalias default'
NVM_TEST_VERSION=v0.10.7
# Remove the stuff we're clobbering.
[ -e ../../$NVM_TEST_VERSION ] && rm -R ../../$NVM_TEST_VERSION
# Install from binary
nvm install $NVM_TEST_VERSION || die "install $NVM_TEST_VERSION failed"
# Check
[ -d ../../$NVM_TEST_VERSION ]
nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION || die "'nvm run $NVM_TEST_VERSION --version | grep $NVM_TEST_VERSION' failed"
[ -O "${NVM_DIR}/${NVM_TEST_VERSION}/bin/node" ] || die "Extracted file is not owned by effective user"
[ -G "${NVM_DIR}/${NVM_TEST_VERSION}/bin/node" ] || die "Extracted file is not owned by effective group"
# ensure default is set
NVM_CURRENT_DEFAULT="$(nvm_alias default)"
[ "$NVM_CURRENT_DEFAULT" = "$NVM_TEST_VERSION" ] || die "wrong default alias: $(nvm alias)"