|
@@ -44,39 +44,35 @@ NPM_VERSION='4.0.5'
|
44
|
44
|
NODEJS_INSTALLED_APPS_FILE=$HOME/.nodejs-apps
|
45
|
45
|
|
46
|
46
|
function mesh_install_nodejs {
|
47
|
|
- # Note: this has to be jessie for now
|
48
|
|
- wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > ${rootdir}/root/node.gpg.key
|
49
|
|
- chroot "${rootdir}" apt-key add /root/node.gpg.key
|
50
|
|
- echo "deb https://deb.nodesource.com/node_6.x jessie main" > ${rootdir}/etc/apt/sources.list.d/nodesource.list
|
51
|
|
- echo "deb-src https://deb.nodesource.com/node_6.x jessie main" >> ${rootdir}/etc/apt/sources.list.d/nodesource.list
|
52
|
|
- chroot "${rootdir}" apt-get update
|
53
|
|
- chroot "${rootdir}" apt-get -yq install nodejs curl
|
|
47
|
+ chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
|
|
48
|
+ chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
|
54
|
49
|
|
55
|
50
|
if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
|
56
|
51
|
echo $'nodejs was not installed'
|
57
|
52
|
exit 63962
|
58
|
53
|
fi
|
59
|
54
|
|
60
|
|
- # TODO this doesn't work
|
61
|
|
-# cat <<EOF > ${rootdir}/root/install-nodejs.sh
|
62
|
|
-##!/bin/bash
|
63
|
|
-#npm install -g npm@${NPM_VERSION} --save
|
64
|
|
-#npm install -g n@${NODEJS_N_VERSION} --save
|
65
|
|
-#n ${NODEJS_VERSION}
|
66
|
|
-#npm install -g pug@2.0.0-beta6 --save
|
67
|
|
-#npm install -g graceful-fs@4.1.10 --save
|
68
|
|
-#npm install -g minimatch@3.0.3 --save
|
69
|
|
-#npm install -g npm@${NPM_VERSION} --save
|
70
|
|
-#cp /usr/local/bin/node /usr/bin/nodejs
|
71
|
|
-#cp /usr/local/bin/npm /usr/bin/npm
|
72
|
|
-#EOF
|
73
|
|
-# chroot "${rootdir}" chmod +x /root/install-nodejs.sh
|
74
|
|
-# chroot "${rootdir}" /root/install-nodejs.sh
|
75
|
|
-# if [ ! "$?" = "0" ]; then
|
76
|
|
-# chroot "${rootdir}" rm -f /root/install-nodejs.sh
|
77
|
|
-# exit 7632572
|
78
|
|
-# fi
|
79
|
|
-# chroot "${rootdir}" rm -f /root/install-nodejs.sh
|
|
55
|
+ if [ -f $rootdir/usr/bin/nodejs ]; then
|
|
56
|
+ cp $rootdir/usr/bin/nodejs $rootdir/usr/bin/node
|
|
57
|
+ fi
|
|
58
|
+
|
|
59
|
+ if [ ! -f $rootdir/usr/bin/node ]; then
|
|
60
|
+ echo $'/usr/bin/node not found'
|
|
61
|
+ exit 7235728
|
|
62
|
+ fi
|
|
63
|
+
|
|
64
|
+ if [ -f /usr/share/npm/bin/npm-cli.js ]; then
|
|
65
|
+ ln -s /usr/share/npm/bin/npm-cli.js /usr/bin/npm
|
|
66
|
+ else
|
|
67
|
+ wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
|
|
68
|
+ if [ ! -f $rootdir/root/npm_install.sh ]; then
|
|
69
|
+ echo $'Unable to download npm installer'
|
|
70
|
+ exit 8793636
|
|
71
|
+ fi
|
|
72
|
+ chroot "$rootdir" chmod +x /root/npm_install.sh
|
|
73
|
+ sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
|
|
74
|
+ chroot "$rootdir" /root/npm_install.sh
|
|
75
|
+ fi
|
80
|
76
|
}
|
81
|
77
|
|
82
|
78
|
function remove_nodejs {
|