Optional chroot when installing nodejs

This commit is contained in:
Bob Mottram 2017-09-19 11:03:45 +01:00
parent 0871350f21
commit 95d12e1384
1 changed files with 10 additions and 6 deletions

View File

@ -61,8 +61,12 @@ function get_npm_arch {
}
function mesh_install_nodejs {
chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
mesh_install_nodejs_prefix=
if [ $rootdir ]; then
mesh_install_nodejs_prefix="chroot $rootdir"
fi
$mesh_install_nodejs_prefix apt-get -yq install g++ m4 libtool automake nodejs curl
$mesh_install_nodejs_prefix apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
echo $'nodejs was not installed'
@ -83,9 +87,9 @@ function mesh_install_nodejs {
echo $'Unable to download npm installer'
exit 8793636
fi
chroot "$rootdir" chmod +x /root/npm_install.sh
$mesh_install_nodejs_prefix chmod +x /root/npm_install.sh
sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
chroot "$rootdir" /root/npm_install.sh
$mesh_install_nodejs_prefix /root/npm_install.sh
if [ ! -f $rootdir/usr/bin/npm ]; then
echo $'npm was not installed'
@ -95,8 +99,8 @@ function mesh_install_nodejs {
# update from the old debian nodejs version
get_npm_arch
chroot "$rootdir" npm install --arch=$NPM_ARCH -g n@${NODEJS_N_VERSION} --save
chroot "$rootdir" n --arch $N_ARCH ${NODEJS_VERSION}
$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
}