Only install the nodejs debian packages in the image
This commit is contained in:
parent
1c8187e4fe
commit
fe8e070b7e
|
@ -1205,68 +1205,6 @@ function image_install_nodejs {
|
|||
echo $'nodejs was not installed'
|
||||
exit 63962
|
||||
fi
|
||||
|
||||
cat <<EOF > $rootdir/root/install-nodejs.sh
|
||||
#!/bin/bash
|
||||
PATH="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/bin"
|
||||
NODE_PATH="/usr/lib/node_modules"
|
||||
cp /usr/bin/nodejs /usr/local/bin/node
|
||||
cp /usr/bin/nodejs /usr/bin/node
|
||||
/usr/bin/curl -0 -L https://npmjs.org/install.sh | sh
|
||||
npm install -g n@${NODEJS_N_VERSION} --save
|
||||
if [ ! -f /usr/local/bin/n ]; then
|
||||
exit 1
|
||||
fi
|
||||
cp /usr/local/bin/n /usr/bin/n
|
||||
n ${NODEJS_VERSION}
|
||||
if [ ! -f /usr/local/bin/node ]; then
|
||||
exit 2
|
||||
fi
|
||||
cp /usr/local/bin/node /usr/bin/nodejs
|
||||
cp /usr/local/bin/node /usr/bin/node
|
||||
npm install -g npm@${NPM_VERSION} --save
|
||||
if [ ! -f /usr/local/bin/npm ]; then
|
||||
exit 3
|
||||
fi
|
||||
cp /usr/local/bin/npm /usr/bin/npm
|
||||
npm install -g pug@2.0.0-beta6 --save
|
||||
npm install -g graceful-fs@4.1.10 --save
|
||||
npm install -g minimatch@3.0.3 --save
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x $rootdir/root/install-nodejs.sh
|
||||
chroot "$rootdir" /root/install-nodejs.sh
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -f $rootdir/root/install-nodejs.sh
|
||||
exit 7632572
|
||||
fi
|
||||
rm -f $rootdir/root/install-nodejs.sh
|
||||
|
||||
# second npm install attempt seems necessary
|
||||
chroot "$rootdir" npm install -g npm@${NPM_VERSION} --save
|
||||
cp $rootdir/usr/local/bin/npm $rootdir/usr/bin/npm
|
||||
|
||||
# node seems tricky so here we're going to double check
|
||||
# that the versions we expect did get installed
|
||||
CURR_NODE_VERSION=$($rootdir/usr/bin/node --version)
|
||||
CURR_NPM_VERSION=$($rootdir/usr/bin/npm --version)
|
||||
CURR_N_VERSION=$($rootdir/usr/bin/n --version)
|
||||
if [[ "$CURR_NPM_VERSION" != "$NPM_VERSION" ]]; then
|
||||
echo $"Expected npm version $NPM_VERSION but actually have $CURR_NPM_VERSION"
|
||||
exit 6728252
|
||||
fi
|
||||
if [[ "$CURR_N_VERSION" != "$NODEJS_N_VERSION" ]]; then
|
||||
echo $"Expected n version $NODEJS_N_VERSION but actually have $CURR_N_VERSION"
|
||||
exit 5267452
|
||||
fi
|
||||
if [[ "$CURR_NODE_VERSION" != "v${NODEJS_VERSION}" ]]; then
|
||||
echo $"Expected node version $NODEJS_VERSION but actually have $CURR_NODE_VERSION"
|
||||
exit 5274527
|
||||
fi
|
||||
|
||||
if ! grep -q "nodejs_base" $rootdir$COMPLETION_FILE; then
|
||||
echo "nodejs_base" >> $rootdir$COMPLETION_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -132,22 +132,20 @@ function install_nodejs {
|
|||
mesh_install_nodejs
|
||||
return
|
||||
fi
|
||||
if ! grep -q "nodejs_base" $COMPLETION_FILE; then
|
||||
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
|
||||
upgrade_nodejs
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $(is_completed $FUNCNAME) == "1" ]]; then
|
||||
upgrade_nodejs
|
||||
return
|
||||
fi
|
||||
apt-get -yq install nodejs
|
||||
apt-get -yq install npm curl
|
||||
|
||||
apt-get -yq install nodejs
|
||||
apt-get -yq install npm curl
|
||||
if [ ! -f /usr/bin/nodejs ]; then
|
||||
echo $'nodejs was not installed'
|
||||
exit 63962
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/bin/nodejs ]; then
|
||||
echo $'nodejs was not installed'
|
||||
exit 63962
|
||||
fi
|
||||
|
||||
cat <<EOF > /root/install-nodejs.sh
|
||||
cat <<EOF > /root/install-nodejs.sh
|
||||
#!/bin/bash
|
||||
PATH="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/bin"
|
||||
NODE_PATH="/usr/lib/node_modules"
|
||||
|
@ -175,35 +173,34 @@ npm install -g graceful-fs@4.1.10 --save
|
|||
npm install -g minimatch@3.0.3 --save
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x /root/install-nodejs.sh
|
||||
/root/install-nodejs.sh
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -f /root/install-nodejs.sh
|
||||
exit 7632572
|
||||
fi
|
||||
chmod +x /root/install-nodejs.sh
|
||||
/root/install-nodejs.sh
|
||||
if [ ! "$?" = "0" ]; then
|
||||
rm -f /root/install-nodejs.sh
|
||||
exit 7632572
|
||||
fi
|
||||
rm -f /root/install-nodejs.sh
|
||||
|
||||
# second npm install attempt seems necessary
|
||||
npm install -g npm@${NPM_VERSION} --save
|
||||
cp /usr/local/bin/npm /usr/bin/npm
|
||||
# second npm install attempt seems necessary
|
||||
npm install -g npm@${NPM_VERSION} --save
|
||||
cp /usr/local/bin/npm /usr/bin/npm
|
||||
|
||||
# node seems tricky so here we're going to double check
|
||||
# that the versions we expect did get installed
|
||||
CURR_NODE_VERSION=$(node --version)
|
||||
CURR_NPM_VERSION=$(npm --version)
|
||||
CURR_N_VERSION=$(n --version)
|
||||
if [[ "$CURR_NPM_VERSION" != "$NPM_VERSION" ]]; then
|
||||
echo $"Expected npm version $NPM_VERSION but actually have $CURR_NPM_VERSION"
|
||||
exit 6728252
|
||||
fi
|
||||
if [[ "$CURR_N_VERSION" != "$NODEJS_N_VERSION" ]]; then
|
||||
echo $"Expected n version $NODEJS_N_VERSION but actually have $CURR_N_VERSION"
|
||||
exit 5267452
|
||||
fi
|
||||
if [[ "$CURR_NODE_VERSION" != "v${NODEJS_VERSION}" ]]; then
|
||||
echo $"Expected node version $NODEJS_VERSION but actually have $CURR_NODE_VERSION"
|
||||
exit 5274527
|
||||
fi
|
||||
# node seems tricky so here we're going to double check
|
||||
# that the versions we expect did get installed
|
||||
CURR_NODE_VERSION=$(node --version)
|
||||
CURR_NPM_VERSION=$(npm --version)
|
||||
CURR_N_VERSION=$(n --version)
|
||||
if [[ "$CURR_NPM_VERSION" != "$NPM_VERSION" ]]; then
|
||||
echo $"Expected npm version $NPM_VERSION but actually have $CURR_NPM_VERSION"
|
||||
exit 6728252
|
||||
fi
|
||||
if [[ "$CURR_N_VERSION" != "$NODEJS_N_VERSION" ]]; then
|
||||
echo $"Expected n version $NODEJS_N_VERSION but actually have $CURR_N_VERSION"
|
||||
exit 5267452
|
||||
fi
|
||||
if [[ "$CURR_NODE_VERSION" != "v${NODEJS_VERSION}" ]]; then
|
||||
echo $"Expected node version $NODEJS_VERSION but actually have $CURR_NODE_VERSION"
|
||||
exit 5274527
|
||||
fi
|
||||
|
||||
if [ $1 ]; then
|
||||
|
|
Loading…
Reference in New Issue