Quellcode durchsuchen

Optional chroot when installing nodejs

Bob Mottram vor 7 Jahren
Ursprung
Commit
95d12e1384
1 geänderte Dateien mit 10 neuen und 6 gelöschten Zeilen
  1. 10
    6
      src/freedombone-utils-nodejs

+ 10
- 6
src/freedombone-utils-nodejs Datei anzeigen

61
 }
61
 }
62
 
62
 
63
 function mesh_install_nodejs {
63
 function mesh_install_nodejs {
64
-    chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
65
-    chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
64
+    mesh_install_nodejs_prefix=
65
+    if [ $rootdir ]; then
66
+        mesh_install_nodejs_prefix="chroot $rootdir"
67
+    fi
68
+    $mesh_install_nodejs_prefix apt-get -yq install g++ m4 libtool automake nodejs curl
69
+    $mesh_install_nodejs_prefix apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
66
 
70
 
67
     if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
71
     if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
68
         echo $'nodejs was not installed'
72
         echo $'nodejs was not installed'
83
         echo $'Unable to download npm installer'
87
         echo $'Unable to download npm installer'
84
         exit 8793636
88
         exit 8793636
85
     fi
89
     fi
86
-    chroot "$rootdir" chmod +x /root/npm_install.sh
90
+    $mesh_install_nodejs_prefix chmod +x /root/npm_install.sh
87
     sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
91
     sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
88
-    chroot "$rootdir" /root/npm_install.sh
92
+    $mesh_install_nodejs_prefix /root/npm_install.sh
89
 
93
 
90
     if [ ! -f $rootdir/usr/bin/npm ]; then
94
     if [ ! -f $rootdir/usr/bin/npm ]; then
91
         echo $'npm was not installed'
95
         echo $'npm was not installed'
95
 
99
 
96
     # update from the old debian nodejs version
100
     # update from the old debian nodejs version
97
     get_npm_arch
101
     get_npm_arch
98
-    chroot "$rootdir" npm install --arch=$NPM_ARCH -g n@${NODEJS_N_VERSION} --save
99
-    chroot "$rootdir" n --arch $N_ARCH ${NODEJS_VERSION}
102
+    $mesh_install_nodejs_prefix npm install --arch=$NPM_ARCH -g n@${NODEJS_N_VERSION} --save
103
+    $mesh_install_nodejs_prefix n --arch $N_ARCH ${NODEJS_VERSION}
100
     cp $rootdir/root/npm $rootdir/usr/bin/npm
104
     cp $rootdir/root/npm $rootdir/usr/bin/npm
101
 }
105
 }
102
 
106