Test nodejs version numbers

This commit is contained in:
Bob Mottram 2017-12-04 11:22:03 +00:00
parent 4a04d29121
commit 1f702d1900
1 changed files with 22 additions and 0 deletions

View File

@ -127,6 +127,28 @@ function mesh_install_nodejs {
$mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g n@${NODEJS_N_VERSION} --save
$mesh_install_nodejs_prefix n --arch $N_ARCH ${NODEJS_VERSION}
cp $rootdir/root/npm $rootdir/usr/bin/npm
# check the version numbers
cat <<EOF > $rootdir/usr/bin/test_nodejs_install
#!/bin/bash
node_version=\$(node -v)
if [[ "\$node_version" != "v${NODEJS_VERSION}" ]]; then
echo $"nodejs version expected to be ${NODEJS_VERSION} but found \$node_version"
exit 1
fi
npm_version=\$(npm -v)
if [[ "\$npm_version" != "v${NPM_VERSION}" ]]; then
echo $"npm version expected to be ${NPM_VERSION} but found \$npm_version"
exit 2
fi
EOF
chmod +x $rootdir/usr/bin/test_nodejs_install
chroot "$rootdir" /usr/bin/test_nodejs_install
if [ ! "$?" = "0" ]; then
echo $"nodejs version numbers did not match. Architecture is $NPM_ARCH."
exit 76835282
fi
rm $rootdir/usr/bin/test_nodejs_install
}
function remove_nodejs {