| 
				
			 | 
			
			
				@@ -169,49 +169,58 @@ function install_nodejs { 
			 | 
		
	
		
			
			| 
				169
			 | 
			
				169
			 | 
			
			
				         return 
			 | 
		
	
		
			
			| 
				170
			 | 
			
				170
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				171
			 | 
			
				171
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				172
			 | 
			
				
			 | 
			
			
				-    if [ ! -f /usr/bin/nodejs ]; then 
			 | 
		
	
		
			
			| 
				173
			 | 
			
				
			 | 
			
			
				-        # Note: this has to be jessie for now 
			 | 
		
	
		
			
			| 
				174
			 | 
			
				
			 | 
			
			
				-        wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > /root/node.gpg.key 
			 | 
		
	
		
			
			| 
				175
			 | 
			
				
			 | 
			
			
				-        apt-key add /root/node.gpg.key 
			 | 
		
	
		
			
			| 
				176
			 | 
			
				
			 | 
			
			
				-        echo "deb https://deb.nodesource.com/node_6.x jessie main" > /etc/apt/sources.list.d/nodesource.list 
			 | 
		
	
		
			
			| 
				177
			 | 
			
				
			 | 
			
			
				-        echo "deb-src https://deb.nodesource.com/node_6.x jessie main" >> /etc/apt/sources.list.d/nodesource.list 
			 | 
		
	
		
			
			| 
				178
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				179
			 | 
			
				
			 | 
			
			
				-        apt-get update 
			 | 
		
	
		
			
			| 
				180
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				181
			 | 
			
				
			 | 
			
			
				-        apt-get -yq remove --purge nodejs 
			 | 
		
	
		
			
			| 
				182
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				183
			 | 
			
				
			 | 
			
			
				-        if [ -d /usr/local/lib/node_modules ]; then 
			 | 
		
	
		
			
			| 
				184
			 | 
			
				
			 | 
			
			
				-            rm -rf /usr/local/lib/node_modules 
			 | 
		
	
		
			
			| 
				185
			 | 
			
				
			 | 
			
			
				-        fi 
			 | 
		
	
		
			
			| 
				186
			 | 
			
				
			 | 
			
			
				-        if [ -f /usr/local/bin/node ]; then 
			 | 
		
	
		
			
			| 
				187
			 | 
			
				
			 | 
			
			
				-            rm /usr/local/bin/node 
			 | 
		
	
		
			
			| 
				188
			 | 
			
				
			 | 
			
			
				-        fi 
			 | 
		
	
		
			
			| 
				189
			 | 
			
				
			 | 
			
			
				-        if [ -f /usr/bin/node ]; then 
			 | 
		
	
		
			
			| 
				190
			 | 
			
				
			 | 
			
			
				-            rm /usr/bin/node 
			 | 
		
	
		
			
			| 
				191
			 | 
			
				
			 | 
			
			
				-        fi 
			 | 
		
	
		
			
			| 
				192
			 | 
			
				
			 | 
			
			
				-        if [ -f /usr/bin/nodejs ]; then 
			 | 
		
	
		
			
			| 
				193
			 | 
			
				
			 | 
			
			
				-            rm /usr/bin/nodejs 
			 | 
		
	
		
			
			| 
				194
			 | 
			
				
			 | 
			
			
				-        fi 
			 | 
		
	
		
			
			| 
				195
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				196
			 | 
			
				
			 | 
			
			
				-        apt-get -yq install nodejs 
			 | 
		
	
		
			
			| 
				197
			 | 
			
				
			 | 
			
			
				-        apt-get -yq install curl 
			 | 
		
	
		
			
			| 
				198
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				199
			 | 
			
				
			 | 
			
			
				-        if [ ! -f /usr/bin/nodejs ]; then 
			 | 
		
	
		
			
			| 
				200
			 | 
			
				
			 | 
			
			
				-            echo $'nodejs was not installed' 
			 | 
		
	
		
			
			| 
				201
			 | 
			
				
			 | 
			
			
				-            exit 63962 
			 | 
		
	
		
			
			| 
				202
			 | 
			
				
			 | 
			
			
				-        fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				172
			 | 
			
			
				+    if [ ! $ARCHITECTURE ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				173
			 | 
			
			
				+        ARCHITECTURE=$(uname -m) 
			 | 
		
	
		
			
			| 
				203
			 | 
			
				174
			 | 
			
			
				     fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				175
			 | 
			
			
				+    rootdir= 
			 | 
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				+    mesh_install_nodejs 
			 | 
		
	
		
			
			| 
				204
			 | 
			
				177
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				205
			 | 
			
				
			 | 
			
			
				-    npm install -g npm@${NPM_VERSION} --save 
			 | 
		
	
		
			
			| 
				206
			 | 
			
				
			 | 
			
			
				-    npm install -g n@${NODEJS_N_VERSION} --save 
			 | 
		
	
		
			
			| 
				207
			 | 
			
				
			 | 
			
			
				-    n ${NODEJS_VERSION} 
			 | 
		
	
		
			
			| 
				208
			 | 
			
				
			 | 
			
			
				-    npm install -g pug@2.0.0-beta6 --save 
			 | 
		
	
		
			
			| 
				209
			 | 
			
				
			 | 
			
			
				-    npm install -g graceful-fs@4.1.10 --save 
			 | 
		
	
		
			
			| 
				210
			 | 
			
				
			 | 
			
			
				-    npm install -g minimatch@3.0.3 --save 
			 | 
		
	
		
			
			| 
				
			 | 
			
				178
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				179
			 | 
			
			
				+    #if [ ! -f /usr/bin/nodejs ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				180
			 | 
			
			
				+        # Note: this has to be jessie for now 
			 | 
		
	
		
			
			| 
				
			 | 
			
				181
			 | 
			
			
				+    #    wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > /root/node.gpg.key 
			 | 
		
	
		
			
			| 
				
			 | 
			
				182
			 | 
			
			
				+    #    apt-key add /root/node.gpg.key 
			 | 
		
	
		
			
			| 
				
			 | 
			
				183
			 | 
			
			
				+    #    echo "deb https://deb.nodesource.com/node_6.x stretch main" > /etc/apt/sources.list.d/nodesource.list 
			 | 
		
	
		
			
			| 
				
			 | 
			
				184
			 | 
			
			
				+    #    echo "deb-src https://deb.nodesource.com/node_6.x stretch main" >> /etc/apt/sources.list.d/nodesource.list 
			 | 
		
	
		
			
			| 
				
			 | 
			
				185
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				186
			 | 
			
			
				+    #    apt-get update 
			 | 
		
	
		
			
			| 
				
			 | 
			
				187
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				188
			 | 
			
			
				+    #    apt-get -yq remove --purge nodejs 
			 | 
		
	
		
			
			| 
				
			 | 
			
				189
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				190
			 | 
			
			
				+    #    if [ -d /usr/local/lib/node_modules ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				191
			 | 
			
			
				+    #        rm -rf /usr/local/lib/node_modules 
			 | 
		
	
		
			
			| 
				
			 | 
			
				192
			 | 
			
			
				+    #    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				193
			 | 
			
			
				+    #    if [ -f /usr/local/bin/node ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				194
			 | 
			
			
				+    #        rm /usr/local/bin/node 
			 | 
		
	
		
			
			| 
				
			 | 
			
				195
			 | 
			
			
				+    #    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				196
			 | 
			
			
				+    #    if [ -f /usr/bin/node ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				197
			 | 
			
			
				+    #        rm /usr/bin/node 
			 | 
		
	
		
			
			| 
				
			 | 
			
				198
			 | 
			
			
				+    #    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				199
			 | 
			
			
				+    #    if [ -f /usr/bin/nodejs ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				200
			 | 
			
			
				+    #        rm /usr/bin/nodejs 
			 | 
		
	
		
			
			| 
				
			 | 
			
				201
			 | 
			
			
				+    #    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				202
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				203
			 | 
			
			
				+    #    apt-get -yq install nodejs 
			 | 
		
	
		
			
			| 
				
			 | 
			
				204
			 | 
			
			
				+    #    apt-get -yq install curl 
			 | 
		
	
		
			
			| 
				
			 | 
			
				205
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				206
			 | 
			
			
				+    #    if [ ! -f /usr/bin/nodejs ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				207
			 | 
			
			
				+    #        echo $'nodejs was not installed' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				208
			 | 
			
			
				+    #        exit 63962 
			 | 
		
	
		
			
			| 
				
			 | 
			
				209
			 | 
			
			
				+    #    fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				210
			 | 
			
			
				+    #fi 
			 | 
		
	
		
			
			| 
				
			 | 
			
				211
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				212
			 | 
			
			
				+    #npm install -g npm@${NPM_VERSION} --save 
			 | 
		
	
		
			
			| 
				
			 | 
			
				213
			 | 
			
			
				+    #npm install -g n@${NODEJS_N_VERSION} --save 
			 | 
		
	
		
			
			| 
				
			 | 
			
				214
			 | 
			
			
				+    #n ${NODEJS_VERSION} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				215
			 | 
			
			
				+    #npm install -g pug@2.0.0-beta6 --save 
			 | 
		
	
		
			
			| 
				
			 | 
			
				216
			 | 
			
			
				+    #npm install -g graceful-fs@4.1.10 --save 
			 | 
		
	
		
			
			| 
				
			 | 
			
				217
			 | 
			
			
				+    #npm install -g minimatch@3.0.3 --save 
			 | 
		
	
		
			
			| 
				211
			 | 
			
				218
			 | 
			
			
				     npm install -g npm@${NPM_VERSION} --save 
			 | 
		
	
		
			
			| 
				212
			 | 
			
				219
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				213
			 | 
			
				
			 | 
			
			
				-    cp /usr/local/bin/node /usr/bin/nodejs 
			 | 
		
	
		
			
			| 
				214
			 | 
			
				
			 | 
			
			
				-    cp /usr/local/bin/npm /usr/bin/npm 
			 | 
		
	
		
			
			| 
				
			 | 
			
				220
			 | 
			
			
				+    #cp /usr/local/bin/node /usr/bin/nodejs 
			 | 
		
	
		
			
			| 
				
			 | 
			
				221
			 | 
			
			
				+    if [ -f /usr/local/bin/npm ]; then 
			 | 
		
	
		
			
			| 
				
			 | 
			
				222
			 | 
			
			
				+        cp /usr/local/bin/npm /usr/bin/npm 
			 | 
		
	
		
			
			| 
				
			 | 
			
				223
			 | 
			
			
				+    fi 
			 | 
		
	
		
			
			| 
				215
			 | 
			
				224
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				216
			 | 
			
				225
			 | 
			
			
				     # node seems tricky so here we're going to double check 
			 | 
		
	
		
			
			| 
				217
			 | 
			
				226
			 | 
			
			
				     # that the versions we expect did get installed 
			 |