Ver código fonte

Update node version on mesh build

Bob Mottram 7 anos atrás
pai
commit
33fe399457
2 arquivos alterados com 19 adições e 7 exclusões
  1. 1
    7
      src/freedombone-image-customise
  2. 18
    0
      src/freedombone-utils-nodejs

+ 1
- 7
src/freedombone-image-customise Ver arquivo

@@ -562,13 +562,7 @@ INSTALL_DIR=$HOME/build
562 562
 INSTALLING_MESH=
563 563
 
564 564
 install_patchwork() {
565
-    NPM_ARCH='ia32'
566
-    if [[ $ARCHITECTURE == 'arm'* ]]; then
567
-        NPM_ARCH='armv7l'
568
-    fi
569
-    if [[ $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'amd64' ]]; then
570
-        NPM_ARCH='x64'
571
-    fi
565
+    get_npm_arch
572 566
 
573 567
     git clone https://github.com/ssbc/patchwork $rootdir/etc/patchwork
574 568
 

+ 18
- 0
src/freedombone-utils-nodejs Ver arquivo

@@ -43,6 +43,16 @@ NPM_VERSION='4.0.5'
43 43
 # so that it can be removed if tere are no apps which need it
44 44
 NODEJS_INSTALLED_APPS_FILE=$HOME/.nodejs-apps
45 45
 
46
+function get_npm_arch {
47
+    NPM_ARCH='ia32'
48
+    if [[ $ARCHITECTURE == 'arm'* ]]; then
49
+        NPM_ARCH='armv7l'
50
+    fi
51
+    if [[ $ARCHITECTURE == 'x86_64' || $ARCHITECTURE == 'amd64' ]]; then
52
+        NPM_ARCH='x64'
53
+    fi
54
+}
55
+
46 56
 function mesh_install_nodejs {
47 57
     chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
48 58
     chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
@@ -73,6 +83,14 @@ function mesh_install_nodejs {
73 83
         sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
74 84
         chroot "$rootdir" /root/npm_install.sh
75 85
     fi
86
+    if [ ! -f $rootdir/usr/bin/npm ]; then
87
+        echo $'npm was not installed'
88
+        exit 5290462
89
+    fi
90
+
91
+    # update from the old debian nodejs version
92
+    get_npm_arch
93
+    chroot "$rootdir" npm install --arch=$NPM_ARCH node@$NODEJS_VERSION -g
76 94
 }
77 95
 
78 96
 function remove_nodejs {