|  | @@ -57,25 +57,26 @@ function mesh_install_nodejs {
 | 
	
		
			
			| 57 | 57 |          exit 63962
 | 
	
		
			
			| 58 | 58 |      fi
 | 
	
		
			
			| 59 | 59 |  
 | 
	
		
			
			| 60 |  | -    cat <<EOF > ${rootdir}/root/install-nodejs.sh
 | 
	
		
			
			| 61 |  | -#!/bin/bash
 | 
	
		
			
			| 62 |  | -npm install -g npm@${NPM_VERSION} --save
 | 
	
		
			
			| 63 |  | -npm install -g n@${NODEJS_N_VERSION} --save
 | 
	
		
			
			| 64 |  | -n ${NODEJS_VERSION}
 | 
	
		
			
			| 65 |  | -npm install -g pug@2.0.0-beta6 --save
 | 
	
		
			
			| 66 |  | -npm install -g graceful-fs@4.1.10 --save
 | 
	
		
			
			| 67 |  | -npm install -g minimatch@3.0.3 --save
 | 
	
		
			
			| 68 |  | -npm install -g npm@${NPM_VERSION} --save
 | 
	
		
			
			| 69 |  | -cp /usr/local/bin/node /usr/bin/nodejs
 | 
	
		
			
			| 70 |  | -cp /usr/local/bin/npm /usr/bin/npm
 | 
	
		
			
			| 71 |  | -EOF
 | 
	
		
			
			| 72 |  | -    chroot "${rootdir}" chmod +x /root/install-nodejs.sh
 | 
	
		
			
			| 73 |  | -    chroot "${rootdir}" /root/install-nodejs.sh
 | 
	
		
			
			| 74 |  | -    if [ ! "$?" = "0" ]; then
 | 
	
		
			
			| 75 |  | -        chroot "${rootdir}" rm -f /root/install-nodejs.sh
 | 
	
		
			
			| 76 |  | -        exit 7632572
 | 
	
		
			
			| 77 |  | -    fi
 | 
	
		
			
			| 78 |  | -    chroot "${rootdir}" rm -f /root/install-nodejs.sh
 | 
	
		
			
			|  | 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
 | 
	
		
			
			| 79 | 80 |  }
 | 
	
		
			
			| 80 | 81 |  
 | 
	
		
			
			| 81 | 82 |  function remove_nodejs {
 | 
	
	
		
			
			|  | @@ -147,35 +148,37 @@ function install_nodejs {
 | 
	
		
			
			| 147 | 148 |          return
 | 
	
		
			
			| 148 | 149 |      fi
 | 
	
		
			
			| 149 | 150 |  
 | 
	
		
			
			| 150 |  | -    # Note: this has to be jessie for now
 | 
	
		
			
			| 151 |  | -    wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > /root/node.gpg.key
 | 
	
		
			
			| 152 |  | -    apt-key add /root/node.gpg.key
 | 
	
		
			
			| 153 |  | -    echo "deb https://deb.nodesource.com/node_7.x jessie main" > /etc/apt/sources.list.d/nodesource.list
 | 
	
		
			
			| 154 |  | -    echo "deb-src https://deb.nodesource.com/node_7.x jessie main" >> /etc/apt/sources.list.d/nodesource.list
 | 
	
		
			
			|  | 151 | +    if [ ! -f /usr/bin/nodejs ]; then
 | 
	
		
			
			|  | 152 | +        # Note: this has to be jessie for now
 | 
	
		
			
			|  | 153 | +        wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > /root/node.gpg.key
 | 
	
		
			
			|  | 154 | +        apt-key add /root/node.gpg.key
 | 
	
		
			
			|  | 155 | +        echo "deb https://deb.nodesource.com/node_7.x jessie main" > /etc/apt/sources.list.d/nodesource.list
 | 
	
		
			
			|  | 156 | +        echo "deb-src https://deb.nodesource.com/node_7.x jessie main" >> /etc/apt/sources.list.d/nodesource.list
 | 
	
		
			
			| 155 | 157 |  
 | 
	
		
			
			| 156 |  | -    apt-get update
 | 
	
		
			
			|  | 158 | +        apt-get update
 | 
	
		
			
			| 157 | 159 |  
 | 
	
		
			
			| 158 |  | -    apt-get -yq remove --purge nodejs
 | 
	
		
			
			|  | 160 | +        apt-get -yq remove --purge nodejs
 | 
	
		
			
			| 159 | 161 |  
 | 
	
		
			
			| 160 |  | -    if [ -d /usr/local/lib/node_modules ]; then
 | 
	
		
			
			| 161 |  | -        rm -rf /usr/local/lib/node_modules
 | 
	
		
			
			| 162 |  | -    fi
 | 
	
		
			
			| 163 |  | -    if [ -f /usr/local/bin/node ]; then
 | 
	
		
			
			| 164 |  | -        rm /usr/local/bin/node
 | 
	
		
			
			| 165 |  | -    fi
 | 
	
		
			
			| 166 |  | -    if [ -f /usr/bin/node ]; then
 | 
	
		
			
			| 167 |  | -        rm /usr/bin/node
 | 
	
		
			
			| 168 |  | -    fi
 | 
	
		
			
			| 169 |  | -    if [ -f /usr/bin/nodejs ]; then
 | 
	
		
			
			| 170 |  | -        rm /usr/bin/nodejs
 | 
	
		
			
			| 171 |  | -    fi
 | 
	
		
			
			|  | 162 | +        if [ -d /usr/local/lib/node_modules ]; then
 | 
	
		
			
			|  | 163 | +            rm -rf /usr/local/lib/node_modules
 | 
	
		
			
			|  | 164 | +        fi
 | 
	
		
			
			|  | 165 | +        if [ -f /usr/local/bin/node ]; then
 | 
	
		
			
			|  | 166 | +            rm /usr/local/bin/node
 | 
	
		
			
			|  | 167 | +        fi
 | 
	
		
			
			|  | 168 | +        if [ -f /usr/bin/node ]; then
 | 
	
		
			
			|  | 169 | +            rm /usr/bin/node
 | 
	
		
			
			|  | 170 | +        fi
 | 
	
		
			
			|  | 171 | +        if [ -f /usr/bin/nodejs ]; then
 | 
	
		
			
			|  | 172 | +            rm /usr/bin/nodejs
 | 
	
		
			
			|  | 173 | +        fi
 | 
	
		
			
			| 172 | 174 |  
 | 
	
		
			
			| 173 |  | -    apt-get -yq install nodejs
 | 
	
		
			
			| 174 |  | -    apt-get -yq install curl
 | 
	
		
			
			|  | 175 | +        apt-get -yq install nodejs
 | 
	
		
			
			|  | 176 | +        apt-get -yq install curl
 | 
	
		
			
			| 175 | 177 |  
 | 
	
		
			
			| 176 |  | -    if [ ! -f /usr/bin/nodejs ]; then
 | 
	
		
			
			| 177 |  | -        echo $'nodejs was not installed'
 | 
	
		
			
			| 178 |  | -        exit 63962
 | 
	
		
			
			|  | 178 | +        if [ ! -f /usr/bin/nodejs ]; then
 | 
	
		
			
			|  | 179 | +            echo $'nodejs was not installed'
 | 
	
		
			
			|  | 180 | +            exit 63962
 | 
	
		
			
			|  | 181 | +        fi
 | 
	
		
			
			| 179 | 182 |      fi
 | 
	
		
			
			| 180 | 183 |  
 | 
	
		
			
			| 181 | 184 |      npm install -g npm@${NPM_VERSION} --save
 |