Tidying of mesh install of nodejs

This commit is contained in:
Bob Mottram 2017-09-13 20:10:28 +01:00
parent 3555879d7c
commit 370561d40f
2 changed files with 24 additions and 51 deletions

View File

@ -562,29 +562,6 @@ INSTALL_DIR=$HOME/build
INSTALLING_MESH=
install_patchwork() {
chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
if [ -f $rootdir/usr/bin/nodejs ]; then
cp $rootdir/usr/bin/nodejs $rootdir/usr/bin/node
fi
if [ ! -f $rootdir/usr/bin/node ]; then
echo $'/usr/bin/node not found'
exit 7235728
fi
if [ -f /usr/share/npm/bin/npm-cli.js ]; then
ln -s /usr/share/npm/bin/npm-cli.js /usr/bin/npm
else
wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
if [ ! -f $rootdir/root/npm_install.sh ]; then
echo $'Unable to download npm installer'
exit 8793636
fi
chroot "$rootdir" 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
fi
git clone https://github.com/ssbc/patchwork $rootdir/etc/patchwork
cat <<EOF > $rootdir/usr/bin/install_patchwork
@ -1506,12 +1483,12 @@ admin_user_sudo
create_generic_image
atheros_wifi
continue_installation
image_install_nodejs
initialise_mesh
configure_wifi
configure_user_interface
image_setup_utils
image_install_inadyn
image_install_nodejs
image_preinstall_repos
# remove downloaded packages

View File

@ -44,39 +44,35 @@ NPM_VERSION='4.0.5'
NODEJS_INSTALLED_APPS_FILE=$HOME/.nodejs-apps
function mesh_install_nodejs {
# Note: this has to be jessie for now
wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > ${rootdir}/root/node.gpg.key
chroot "${rootdir}" apt-key add /root/node.gpg.key
echo "deb https://deb.nodesource.com/node_6.x jessie main" > ${rootdir}/etc/apt/sources.list.d/nodesource.list
echo "deb-src https://deb.nodesource.com/node_6.x jessie main" >> ${rootdir}/etc/apt/sources.list.d/nodesource.list
chroot "${rootdir}" apt-get update
chroot "${rootdir}" apt-get -yq install nodejs curl
chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
echo $'nodejs was not installed'
exit 63962
fi
# TODO this doesn't work
# cat <<EOF > ${rootdir}/root/install-nodejs.sh
##!/bin/bash
#npm install -g npm@${NPM_VERSION} --save
#npm install -g n@${NODEJS_N_VERSION} --save
#n ${NODEJS_VERSION}
#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
#npm install -g npm@${NPM_VERSION} --save
#cp /usr/local/bin/node /usr/bin/nodejs
#cp /usr/local/bin/npm /usr/bin/npm
#EOF
# chroot "${rootdir}" chmod +x /root/install-nodejs.sh
# chroot "${rootdir}" /root/install-nodejs.sh
# if [ ! "$?" = "0" ]; then
# chroot "${rootdir}" rm -f /root/install-nodejs.sh
# exit 7632572
# fi
# chroot "${rootdir}" rm -f /root/install-nodejs.sh
if [ -f $rootdir/usr/bin/nodejs ]; then
cp $rootdir/usr/bin/nodejs $rootdir/usr/bin/node
fi
if [ ! -f $rootdir/usr/bin/node ]; then
echo $'/usr/bin/node not found'
exit 7235728
fi
if [ -f /usr/share/npm/bin/npm-cli.js ]; then
ln -s /usr/share/npm/bin/npm-cli.js /usr/bin/npm
else
wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
if [ ! -f $rootdir/root/npm_install.sh ]; then
echo $'Unable to download npm installer'
exit 8793636
fi
chroot "$rootdir" 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
fi
}
function remove_nodejs {