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'
|
echo $'nodejs was not installed'
|
||||||
exit 63962
|
exit 63962
|
||||||
fi
|
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
|
mesh_install_nodejs
|
||||||
return
|
return
|
||||||
fi
|
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
|
apt-get -yq install nodejs
|
||||||
upgrade_nodejs
|
apt-get -yq install npm curl
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
apt-get -yq install nodejs
|
if [ ! -f /usr/bin/nodejs ]; then
|
||||||
apt-get -yq install npm curl
|
echo $'nodejs was not installed'
|
||||||
|
exit 63962
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f /usr/bin/nodejs ]; then
|
cat <<EOF > /root/install-nodejs.sh
|
||||||
echo $'nodejs was not installed'
|
|
||||||
exit 63962
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF > /root/install-nodejs.sh
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
PATH="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/bin"
|
PATH="/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/bin"
|
||||||
NODE_PATH="/usr/lib/node_modules"
|
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
|
npm install -g minimatch@3.0.3 --save
|
||||||
exit 0
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
chmod +x /root/install-nodejs.sh
|
chmod +x /root/install-nodejs.sh
|
||||||
/root/install-nodejs.sh
|
/root/install-nodejs.sh
|
||||||
if [ ! "$?" = "0" ]; then
|
if [ ! "$?" = "0" ]; then
|
||||||
rm -f /root/install-nodejs.sh
|
|
||||||
exit 7632572
|
|
||||||
fi
|
|
||||||
rm -f /root/install-nodejs.sh
|
rm -f /root/install-nodejs.sh
|
||||||
|
exit 7632572
|
||||||
|
fi
|
||||||
|
rm -f /root/install-nodejs.sh
|
||||||
|
|
||||||
# second npm install attempt seems necessary
|
# second npm install attempt seems necessary
|
||||||
npm install -g npm@${NPM_VERSION} --save
|
npm install -g npm@${NPM_VERSION} --save
|
||||||
cp /usr/local/bin/npm /usr/bin/npm
|
cp /usr/local/bin/npm /usr/bin/npm
|
||||||
|
|
||||||
# node seems tricky so here we're going to double check
|
# node seems tricky so here we're going to double check
|
||||||
# that the versions we expect did get installed
|
# that the versions we expect did get installed
|
||||||
CURR_NODE_VERSION=$(node --version)
|
CURR_NODE_VERSION=$(node --version)
|
||||||
CURR_NPM_VERSION=$(npm --version)
|
CURR_NPM_VERSION=$(npm --version)
|
||||||
CURR_N_VERSION=$(n --version)
|
CURR_N_VERSION=$(n --version)
|
||||||
if [[ "$CURR_NPM_VERSION" != "$NPM_VERSION" ]]; then
|
if [[ "$CURR_NPM_VERSION" != "$NPM_VERSION" ]]; then
|
||||||
echo $"Expected npm version $NPM_VERSION but actually have $CURR_NPM_VERSION"
|
echo $"Expected npm version $NPM_VERSION but actually have $CURR_NPM_VERSION"
|
||||||
exit 6728252
|
exit 6728252
|
||||||
fi
|
fi
|
||||||
if [[ "$CURR_N_VERSION" != "$NODEJS_N_VERSION" ]]; then
|
if [[ "$CURR_N_VERSION" != "$NODEJS_N_VERSION" ]]; then
|
||||||
echo $"Expected n version $NODEJS_N_VERSION but actually have $CURR_N_VERSION"
|
echo $"Expected n version $NODEJS_N_VERSION but actually have $CURR_N_VERSION"
|
||||||
exit 5267452
|
exit 5267452
|
||||||
fi
|
fi
|
||||||
if [[ "$CURR_NODE_VERSION" != "v${NODEJS_VERSION}" ]]; then
|
if [[ "$CURR_NODE_VERSION" != "v${NODEJS_VERSION}" ]]; then
|
||||||
echo $"Expected node version $NODEJS_VERSION but actually have $CURR_NODE_VERSION"
|
echo $"Expected node version $NODEJS_VERSION but actually have $CURR_NODE_VERSION"
|
||||||
exit 5274527
|
exit 5274527
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 ]; then
|
if [ $1 ]; then
|
||||||
|
|
Loading…
Reference in New Issue