Pārlūkot izejas kodu

Tidying of mesh install of nodejs

Bob Mottram 7 gadus atpakaļ
vecāks
revīzija
370561d40f
2 mainītis faili ar 24 papildinājumiem un 51 dzēšanām
  1. 1
    24
      src/freedombone-image-customise
  2. 23
    27
      src/freedombone-utils-nodejs

+ 1
- 24
src/freedombone-image-customise Parādīt failu

562
 INSTALLING_MESH=
562
 INSTALLING_MESH=
563
 
563
 
564
 install_patchwork() {
564
 install_patchwork() {
565
-    chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
566
-    chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
567
-
568
-    if [ -f $rootdir/usr/bin/nodejs ]; then
569
-        cp $rootdir/usr/bin/nodejs $rootdir/usr/bin/node
570
-    fi
571
-    if [ ! -f $rootdir/usr/bin/node ]; then
572
-        echo $'/usr/bin/node not found'
573
-        exit 7235728
574
-    fi
575
-    if [ -f /usr/share/npm/bin/npm-cli.js ]; then
576
-        ln -s /usr/share/npm/bin/npm-cli.js /usr/bin/npm
577
-    else
578
-        wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
579
-        if [ ! -f $rootdir/root/npm_install.sh ]; then
580
-            echo $'Unable to download npm installer'
581
-            exit 8793636
582
-        fi
583
-        chroot "$rootdir" chmod +x /root/npm_install.sh
584
-        sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
585
-        chroot "$rootdir" /root/npm_install.sh
586
-    fi
587
-
588
     git clone https://github.com/ssbc/patchwork $rootdir/etc/patchwork
565
     git clone https://github.com/ssbc/patchwork $rootdir/etc/patchwork
589
 
566
 
590
     cat <<EOF > $rootdir/usr/bin/install_patchwork
567
     cat <<EOF > $rootdir/usr/bin/install_patchwork
1506
 create_generic_image
1483
 create_generic_image
1507
 atheros_wifi
1484
 atheros_wifi
1508
 continue_installation
1485
 continue_installation
1486
+image_install_nodejs
1509
 initialise_mesh
1487
 initialise_mesh
1510
 configure_wifi
1488
 configure_wifi
1511
 configure_user_interface
1489
 configure_user_interface
1512
 image_setup_utils
1490
 image_setup_utils
1513
 image_install_inadyn
1491
 image_install_inadyn
1514
-image_install_nodejs
1515
 image_preinstall_repos
1492
 image_preinstall_repos
1516
 
1493
 
1517
 # remove downloaded packages
1494
 # remove downloaded packages

+ 23
- 27
src/freedombone-utils-nodejs Parādīt failu

44
 NODEJS_INSTALLED_APPS_FILE=$HOME/.nodejs-apps
44
 NODEJS_INSTALLED_APPS_FILE=$HOME/.nodejs-apps
45
 
45
 
46
 function mesh_install_nodejs {
46
 function mesh_install_nodejs {
47
-    # Note: this has to be jessie for now
48
-    wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key > ${rootdir}/root/node.gpg.key
49
-    chroot "${rootdir}" apt-key add /root/node.gpg.key
50
-    echo "deb https://deb.nodesource.com/node_6.x jessie main" > ${rootdir}/etc/apt/sources.list.d/nodesource.list
51
-    echo "deb-src https://deb.nodesource.com/node_6.x jessie main" >> ${rootdir}/etc/apt/sources.list.d/nodesource.list
52
-    chroot "${rootdir}" apt-get update
53
-    chroot "${rootdir}" apt-get -yq install nodejs curl
47
+    chroot "$rootdir" apt-get -yq install g++ m4 libtool automake nodejs curl
48
+    chroot "$rootdir" apt-get -yq install libxext-dev libxtst-dev libxkbfile-dev
54
 
49
 
55
     if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
50
     if [ ! -f ${rootdir}/usr/bin/nodejs ]; then
56
         echo $'nodejs was not installed'
51
         echo $'nodejs was not installed'
57
         exit 63962
52
         exit 63962
58
     fi
53
     fi
59
 
54
 
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
55
+    if [ -f $rootdir/usr/bin/nodejs ]; then
56
+        cp $rootdir/usr/bin/nodejs $rootdir/usr/bin/node
57
+    fi
58
+
59
+    if [ ! -f $rootdir/usr/bin/node ]; then
60
+        echo $'/usr/bin/node not found'
61
+        exit 7235728
62
+    fi
63
+
64
+    if [ -f /usr/share/npm/bin/npm-cli.js ]; then
65
+        ln -s /usr/share/npm/bin/npm-cli.js /usr/bin/npm
66
+    else
67
+        wget https://www.npmjs.com/install.sh -O $rootdir/root/npm_install.sh
68
+        if [ ! -f $rootdir/root/npm_install.sh ]; then
69
+            echo $'Unable to download npm installer'
70
+            exit 8793636
71
+        fi
72
+        chroot "$rootdir" chmod +x /root/npm_install.sh
73
+        sed -i "s|t=\"\${npm_install}\"|t=\"$NPM_VERSION\"|g" $rootdir/root/npm_install.sh
74
+        chroot "$rootdir" /root/npm_install.sh
75
+    fi
80
 }
76
 }
81
 
77
 
82
 function remove_nodejs {
78
 function remove_nodejs {