Derive $node_install_path from $NODE_PATH
This commit is contained in:
parent
2831949296
commit
94e18f04a9
|
@ -1,3 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$NODE_PATH" ]; then
|
||||||
|
node_install_path=$(dirname $(dirname $NODE_PATH))
|
||||||
|
else
|
||||||
|
node_install_path=$PREFIX/usr/local
|
||||||
|
fi
|
||||||
|
|
||||||
NODEJS_VER=${1}
|
NODEJS_VER=${1}
|
||||||
NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1)
|
NODEJS_VERT=$(echo ${NODEJS_VER} | cut -c 2- | cut -d '.' -f1)
|
||||||
|
|
||||||
|
@ -45,9 +53,9 @@ if [ -n "${NODEJS_VER}" ]; then
|
||||||
mkdir -p ${NODEJS_UNTAR}/
|
mkdir -p ${NODEJS_UNTAR}/
|
||||||
tar xf ${NODEJS_LOCAL} -C ${NODEJS_UNTAR}/ --strip-components=1
|
tar xf ${NODEJS_LOCAL} -C ${NODEJS_UNTAR}/ --strip-components=1
|
||||||
rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md}
|
rm ${NODEJS_UNTAR}/{LICENSE,CHANGELOG.md,README.md}
|
||||||
sudo rsync -a "${NODEJS_UNTAR}/" /usr/local/
|
sudo rsync -a "${NODEJS_UNTAR}/" "$node_install_path"
|
||||||
|
|
||||||
|
|
||||||
sudo chown -R $(whoami) /usr/local/lib/node_modules/
|
sudo chown -R $(whoami) "$node_install_path/lib/node_modules/"
|
||||||
sudo chown $(whoami) /usr/local/bin/
|
sudo chown $(whoami) ""$node_install_path"/bin/"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue