Use upgrade flag to prevent global node modules from being removed
This commit is contained in:
parent
f6becba882
commit
f1ca6f0329
|
@ -72,6 +72,7 @@ function mesh_install_nodejs {
|
||||||
$mesh_install_nodejs_prefix wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O /root/node.gpg.key
|
$mesh_install_nodejs_prefix wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O /root/node.gpg.key
|
||||||
if [ ! -f "$rootdir/root/node.gpg.key" ]; then
|
if [ ! -f "$rootdir/root/node.gpg.key" ]; then
|
||||||
echo $'Unable to obtain gpg key for nodejs repo'
|
echo $'Unable to obtain gpg key for nodejs repo'
|
||||||
|
NODE_UPGRADE=
|
||||||
exit 6389252
|
exit 6389252
|
||||||
fi
|
fi
|
||||||
$mesh_install_nodejs_prefix apt-key add /root/node.gpg.key
|
$mesh_install_nodejs_prefix apt-key add /root/node.gpg.key
|
||||||
|
@ -82,9 +83,12 @@ function mesh_install_nodejs {
|
||||||
$mesh_install_nodejs_prefix apt-get update
|
$mesh_install_nodejs_prefix apt-get update
|
||||||
$mesh_install_nodejs_prefix apt-get -yq remove --purge nodejs
|
$mesh_install_nodejs_prefix apt-get -yq remove --purge nodejs
|
||||||
|
|
||||||
if [ -d "$rootdir/usr/local/lib/node_modules" ]; then
|
if [ ! $NODE_UPGRADE ]; then
|
||||||
rm -rf "$rootdir/usr/local/lib/node_modules"
|
if [ -d "$rootdir/usr/local/lib/node_modules" ]; then
|
||||||
|
rm -rf "$rootdir/usr/local/lib/node_modules"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$rootdir/usr/local/bin/node" ]; then
|
if [ -f "$rootdir/usr/local/bin/node" ]; then
|
||||||
rm "$rootdir/usr/local/bin/node"
|
rm "$rootdir/usr/local/bin/node"
|
||||||
fi
|
fi
|
||||||
|
@ -111,6 +115,7 @@ function mesh_install_nodejs {
|
||||||
if [ ! -f "${rootdir}/usr/local/bin/node" ]; then
|
if [ ! -f "${rootdir}/usr/local/bin/node" ]; then
|
||||||
if [ ! -f "${rootdir}/usr/bin/nodejs" ]; then
|
if [ ! -f "${rootdir}/usr/bin/nodejs" ]; then
|
||||||
echo $'nodejs was not installed'
|
echo $'nodejs was not installed'
|
||||||
|
NODE_UPGRADE=
|
||||||
exit 63962
|
exit 63962
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -118,6 +123,7 @@ function mesh_install_nodejs {
|
||||||
|
|
||||||
if [ ! -f "$rootdir/usr/bin/node" ]; then
|
if [ ! -f "$rootdir/usr/bin/node" ]; then
|
||||||
echo $'/usr/bin/node not found'
|
echo $'/usr/bin/node not found'
|
||||||
|
NODE_UPGRADE=
|
||||||
exit 7235728
|
exit 7235728
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -162,9 +168,11 @@ EOF
|
||||||
chmod +x "$rootdir/usr/bin/test_nodejs_install"
|
chmod +x "$rootdir/usr/bin/test_nodejs_install"
|
||||||
if ! $mesh_install_nodejs_prefix /usr/bin/test_nodejs_install; then
|
if ! $mesh_install_nodejs_prefix /usr/bin/test_nodejs_install; then
|
||||||
echo $"nodejs version numbers did not match. Architecture is $NPM_ARCH."
|
echo $"nodejs version numbers did not match. Architecture is $NPM_ARCH."
|
||||||
|
NODE_UPGRADE=
|
||||||
exit 76835282
|
exit 76835282
|
||||||
fi
|
fi
|
||||||
rm "$rootdir/usr/bin/test_nodejs_install"
|
rm "$rootdir/usr/bin/test_nodejs_install"
|
||||||
|
NODE_UPGRADE=
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodejs_upgrade {
|
function nodejs_upgrade {
|
||||||
|
@ -187,6 +195,7 @@ function nodejs_upgrade {
|
||||||
fi
|
fi
|
||||||
read_config_param ARCHITECTURE
|
read_config_param ARCHITECTURE
|
||||||
get_npm_arch
|
get_npm_arch
|
||||||
|
NODE_UPGRADE=1
|
||||||
rootdir=
|
rootdir=
|
||||||
mesh_install_nodejs
|
mesh_install_nodejs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue