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= INSTALLING_MESH=
install_patchwork() { 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 git clone https://github.com/ssbc/patchwork $rootdir/etc/patchwork
cat <<EOF > $rootdir/usr/bin/install_patchwork cat <<EOF > $rootdir/usr/bin/install_patchwork
@ -1506,12 +1483,12 @@ admin_user_sudo
create_generic_image create_generic_image
atheros_wifi atheros_wifi
continue_installation continue_installation
image_install_nodejs
initialise_mesh initialise_mesh
configure_wifi configure_wifi
configure_user_interface configure_user_interface
image_setup_utils image_setup_utils
image_install_inadyn image_install_inadyn
image_install_nodejs
image_preinstall_repos image_preinstall_repos
# remove downloaded packages # remove downloaded packages

View File

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