diff options
Diffstat (limited to 'meta-iot/recipes-web')
12 files changed, 459 insertions, 0 deletions
diff --git a/meta-iot/recipes-web/the-thing-system/steward-init.bb b/meta-iot/recipes-web/the-thing-system/steward-init.bb new file mode 100644 index 0000000..3f58251 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init.bb | |||
@@ -0,0 +1,40 @@ | |||
1 | SUMMARY = "Initialization service for TheThingSystem steward" | ||
2 | DESCRIPTION = "Initializes TheThingSystem steward services." | ||
3 | |||
4 | LICENSE = "MIT" | ||
5 | LIC_FILES_CHKSUM = "file://LICENSE.steward-init;md5=2fe93140f8c4e56b56fbcd64730767a4" | ||
6 | |||
7 | SRC_URI = "\ | ||
8 | file://steward-init-settings.sh \ | ||
9 | file://steward-init.service.in \ | ||
10 | file://LICENSE.steward-init \ | ||
11 | " | ||
12 | |||
13 | S = "${WORKDIR}" | ||
14 | PR = "r2" | ||
15 | |||
16 | THE_THING_SYSTEM ?= "/opt/TheThingSystem" | ||
17 | |||
18 | inherit systemd | ||
19 | SYSTEMD_PACKAGES = "${PN}" | ||
20 | SYSTEMD_SERVICE_${PN} = "steward-init.service" | ||
21 | |||
22 | FILES_${PN} = "\ | ||
23 | ${THE_THING_SYSTEM}/steward/* \ | ||
24 | ${sysconfdir}/TheThingSystem/* \ | ||
25 | " | ||
26 | |||
27 | do_install() { | ||
28 | install -d ${D}${THE_THING_SYSTEM}/steward | ||
29 | install -d ${D}${systemd_unitdir}/system | ||
30 | install -m 0755 ${WORKDIR}/steward-init-settings.sh ${D}${THE_THING_SYSTEM}/steward | ||
31 | |||
32 | sed 's,@the_thing_system_dir@,${THE_THING_SYSTEM},g' < ${WORKDIR}/steward-init.service.in \ | ||
33 | > ${D}${systemd_unitdir}/system/steward-init.service | ||
34 | |||
35 | install -d ${D}/etc/TheThingSystem | ||
36 | echo "# Configuration options for TheThingSystem/steward" > ${D}/etc/TheThingSystem/config | ||
37 | echo "# Generated `date`" >> ${D}/etc/TheThingSystem/config | ||
38 | echo "THE_THING_SYSTEM=${THE_THING_SYSTEM}" >> ${D}/etc/TheThingSystem/config | ||
39 | echo "NODE_PATH=${THE_THING_SYSTEM}/steward" >> ${D}/etc/TheThingSystem/config | ||
40 | } | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init b/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init new file mode 100644 index 0000000..0388698 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/LICENSE.steward-init | |||
@@ -0,0 +1,9 @@ | |||
1 | # LICENSE | ||
2 | |||
3 | [MIT](http://en.wikipedia.org/wiki/MIT_License) license. Freely have you received, freely give. | ||
4 | |||
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
6 | |||
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
8 | |||
9 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh new file mode 100755 index 0000000..40f75ee --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init-settings.sh | |||
@@ -0,0 +1,62 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | if [ -z "$THE_THING_SYSTEM" ]; then | ||
4 | THE_THING_SYSTEM=/opt/TheThingSystem | ||
5 | export THE_THING_SYSTEM | ||
6 | fi | ||
7 | |||
8 | STEWARD_DIR=${THE_THING_SYSTEM}/steward | ||
9 | STEWARD_SETTINGS=$STEWARD_DIR/db/server.key | ||
10 | |||
11 | RET=0 | ||
12 | |||
13 | if [ -s $STEWARD_SETTINGS ]; then | ||
14 | exit 0 | ||
15 | fi | ||
16 | |||
17 | # Change the port of the eca-web so that steward web-ui can live in | ||
18 | # port 80. Eca-web will be moved to HTTP port 8080. | ||
19 | sed -i 's/PORT=80$/PORT=8080/' /etc/eca-web/config | ||
20 | |||
21 | if [ ! -d $STEWARD_DIR/sandbox ]; then | ||
22 | mkdir -p $STEWARD_DIR/sandbox | ||
23 | fi | ||
24 | if [ ! -d $STEWARD_DIR/db ]; then | ||
25 | mkdir -p $STEWARD_DIR/db | ||
26 | fi | ||
27 | |||
28 | if [ -z "$NODE_PATH" ]; then | ||
29 | NODE_PATH=${THE_THING_SYSTEM}/steward | ||
30 | export NODE_PATH | ||
31 | fi | ||
32 | |||
33 | cd $THE_THING_SYSTEM/steward | ||
34 | |||
35 | echo -n "Creating server key..." | ||
36 | rm -f ${STEWARD_DIR}/sandbox/server.crt ${STEWARD_DIR}/sandbox/server.sha1 | ||
37 | |||
38 | node <<EOF | ||
39 | require('x509-keygen').x509_keygen({ subject : '/CN=steward' | ||
40 | , keyfile : '${STEWARD_DIR}/db/server.key' | ||
41 | , certfile : '${STEWARD_DIR}/sandbox/server.crt' | ||
42 | , sha1file : '${STEWARD_DIR}/sandbox/server.sha1' | ||
43 | , alternates : [ 'DNS:' + require('os').hostname(), 'DNS:eca.local' ] | ||
44 | , destroy : false }, function(err, data) { | ||
45 | if (err) return console.log('keypair generation error: ' + err.message); | ||
46 | |||
47 | console.log('keypair generated.'); | ||
48 | }); | ||
49 | EOF | ||
50 | |||
51 | if [ -f ${STEWARD_DIR}/db/server.key ]; then | ||
52 | chmod 400 ${STEWARD_DIR}/db/server.key | ||
53 | chmod 444 ${STEWARD_DIR}/sandbox/server.crt | ||
54 | chmod 444 ${STEWARD_DIR}/sandbox/server.sha1 | ||
55 | else | ||
56 | rm -f ${STEWARD_DIR}/db/server.key ${STEWARD_DIR}/sandbox/server.crt \ | ||
57 | ${STEWARD_DIR}/sandbox/server.sha1 | ||
58 | echo "unable to create self-signed server certificate" 1>&2 | ||
59 | RET=1 | ||
60 | fi | ||
61 | |||
62 | exit $RET | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in new file mode 100644 index 0000000..feed7f5 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward-init/steward-init.service.in | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=Initialize TheThingSystem steward settings | ||
3 | After=syslog.target | ||
4 | Before=eca-web.service | ||
5 | ConditionFileNotEmpty=!@the_thing_system_dir@/steward/db/server.key | ||
6 | |||
7 | [Service] | ||
8 | Type=oneshot | ||
9 | EnvironmentFile=-/etc/TheThingSystem/config | ||
10 | ExecStart=-@the_thing_system_dir@/steward/steward-init-settings.sh | ||
11 | StandardOutput=null | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=steward.service | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward/npm-setup-proxies.example b/meta-iot/recipes-web/the-thing-system/steward/npm-setup-proxies.example new file mode 100644 index 0000000..e52bf27 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/npm-setup-proxies.example | |||
@@ -0,0 +1,5 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # Setup proxies | ||
4 | npm config set proxy http://proxy.example.com:8080 | ||
5 | npm config set https-proxy http://proxy.example.com:8080 | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward/package.json b/meta-iot/recipes-web/the-thing-system/steward/package.json new file mode 100644 index 0000000..ff865f2 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/package.json | |||
@@ -0,0 +1,90 @@ | |||
1 | { "name" : "node-steward" | ||
2 | , "readmeFilename" : "README.md" | ||
3 | , "version" : "1.5.1" | ||
4 | , "private" : true | ||
5 | , "engines" : | ||
6 | { "node" : ">=0.10.22" | ||
7 | } | ||
8 | , "license" : "MIT" | ||
9 | , "dependencies" : | ||
10 | { "MD5" : "1.0.3" | ||
11 | , "aerogel" : "git://github.com/TheThingSystem/aerogel.git" | ||
12 | , "airplay" : "git://github.com/TheThingSystem/node-airplay.git" | ||
13 | , "arp-a" : "0.3.0" | ||
14 | , "async" : "0.2.9" | ||
15 | , "axiscam" : "0.0.4" | ||
16 | , "automatic-api" : "0.9.3" | ||
17 | , "avahi_pub" : "git://github.com/TheThingSystem/node_avahi_pub.git" | ||
18 | , "blinkstick" : "git://github.com/TheThingSystem/blinkstick-node.git" | ||
19 | , "color-convert" : "0.3.1" | ||
20 | , "colors" : "0.6.2" | ||
21 | , "cosm" : "git://github.com/TheThingSystem/node-cosm.git" | ||
22 | , "cron-parser" : "git://github.com/TheThingSystem/node-cron-parser.git" | ||
23 | , "cycle" : "1.0.2" | ||
24 | , "eureka-dongle" : "0.1.0" | ||
25 | , "flower-power-cloud" : "0.2.0" | ||
26 | , "geocoder" : "0.1.0" | ||
27 | , "greenwave-gop" : "0.0.2" | ||
28 | , "grovestreams-api" : "0.2.3" | ||
29 | , "irobot" : "git://github.com/TheThingSystem/irobot.git" | ||
30 | , "json-stringify-safe" : "4.0.0" | ||
31 | , "koubachi" : "0.0.4" | ||
32 | , "lifx" : "git://github.com/TheThingSystem/lifxjs.git" | ||
33 | , "line-reader" : "0.2.3" | ||
34 | , "lockitron-api" : "0.3.1" | ||
35 | , "longjohn" : "0.2.0" | ||
36 | , "lumen" : "git://github.com/TheThingSystem/node-lumen.git" | ||
37 | , "mdns" : "git://github.com/TheThingSystem/node_mdns.git" | ||
38 | , "mime" : "1.2.9" | ||
39 | , "mqtt" : "git://github.com/TheThingSystem/MQTT.js.git" | ||
40 | , "netmask" : "1.0.4" | ||
41 | , "noble" : "git://github.com/jukkar/noble.git" | ||
42 | , "node-blink1" : "0.1.0" | ||
43 | , "node-cassandra-cql" : "git://github.com/TheThingSystem/node-cassandra-cql.git" | ||
44 | , "node-dweetio" : "0.0.8" | ||
45 | , "node-hid" : "0.2.3" | ||
46 | , "node-lsof" : "git://github.com/TheThingSystem/node-lsof.git" | ||
47 | , "node-netatmo" : "git://github.com/TheThingSystem/node-netatmo.git" | ||
48 | , "notify-my-android" : "0.0.1" | ||
49 | , "node-prowl" : "git://github.com/TheThingSystem/node-prowl.git" | ||
50 | , "node-ssdp" : "git://github.com/TheThingSystem/node-ssdp.git" | ||
51 | , "node-ssh-fingerprint" : "git://github.com/TheThingSystem/node-ssh-fingerprint.git" | ||
52 | , "node-uuid" : "1.4.0" | ||
53 | , "node-winkapi" : "0.1.2" | ||
54 | , "observer" : "1.1.0" | ||
55 | , "openzwave" : "0.0.32" | ||
56 | , "pcap" : "1.2.0" | ||
57 | , "pkginfo" : "0.3.0" | ||
58 | , "pixelpusher" : "0.1.1" | ||
59 | , "polyline-encoded" : "0.0.4" | ||
60 | , "portfinder" : "0.2.1" | ||
61 | , "rfxcom" : "git://github.com/TheThingSystem/node-rfxcom.git" | ||
62 | , "robosmart" : "0.1.1" | ||
63 | , "roku" : "0.2.0" | ||
64 | , "samsung-airconditioner" : "git://github.com/TheThingSystem/node-samsung-airconditioner.git" | ||
65 | , "sensortag" : "git://github.com/sandeepmistry/node-sensortag.git" | ||
66 | , "serialport" : "~1.1.0" | ||
67 | , "soap" : "0.2.7" | ||
68 | , "sonos" : "git://github.com/TheThingSystem/node-sonos.git" | ||
69 | , "speakeasy" : "git://github.com/TheThingSystem/speakeasy.git" | ||
70 | , "sqlite3" : "2.1.7" | ||
71 | , "ssh-keygen" : "git://github.com/TheThingSystem/ssh-keygen.git" | ||
72 | , "stack-trace" : "0.0.6" | ||
73 | , "suncalc" : "1.2.1" | ||
74 | , "teslams" : "0.8.6" | ||
75 | , "underscore" : "1.5.1" | ||
76 | , "unofficial-nest-api" : "git://github.com/TheThingSystem/unofficial_nodejs_nest.git" | ||
77 | , "validator" : "1.1.3" | ||
78 | , "wake_on_lan" : "0.0.3" | ||
79 | , "winston" : "0.6.2" | ||
80 | , "ws" : "git://github.com/TheThingSystem/ws.git" | ||
81 | , "x509-keygen" : "0.2.2" | ||
82 | , "xml2js" : "0.2.7" | ||
83 | , "xml2json" : "0.3.2" | ||
84 | , "xmlbuilder" : "0.4.x" | ||
85 | , "xmldom" : "0.1.x" | ||
86 | , "xmlhttprequest" : "git://github.com/TheThingSystem/node-XMLHttpRequest.git" | ||
87 | , "yoctolib" : "git://github.com/TheThingSystem/yoctolib_nodejs.git" | ||
88 | , "yql" : "git://github.com/TheThingSystem/node-yql.git" | ||
89 | } | ||
90 | } | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward/server.js.in b/meta-iot/recipes-web/the-thing-system/steward/server.js.in new file mode 100644 index 0000000..32f6b82 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/server.js.in | |||
@@ -0,0 +1,3 @@ | |||
1 | require('@the_thing_system_dir@/steward/core/utility').start(); | ||
2 | require('@the_thing_system_dir@/steward/core/database').start(); | ||
3 | require('@the_thing_system_dir@/steward/core/steward').start(); | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward/start-steward b/meta-iot/recipes-web/the-thing-system/steward/start-steward new file mode 100755 index 0000000..1022656 --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/start-steward | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | DIR=`dirname $0` | ||
4 | |||
5 | if [ ! -f $DIR/server.js ]; then | ||
6 | echo "$0: Cannot find $DIR/server.js" | ||
7 | exit -1 | ||
8 | fi | ||
9 | |||
10 | if [ -z "$THE_THING_SYSTEM" ]; then | ||
11 | THE_THING_SYSTEM=/opt/TheThingSystem | ||
12 | export THE_THING_SYSTEM | ||
13 | fi | ||
14 | |||
15 | if [ -z "$NODE_PATH" ]; then | ||
16 | NODE_PATH=${THE_THING_SYSTEM}/steward | ||
17 | export NODE_PATH | ||
18 | fi | ||
19 | |||
20 | cd $DIR | ||
21 | node $DIR/server.js $@ | ||
22 | exit $? | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward/start-steward.debug b/meta-iot/recipes-web/the-thing-system/steward/start-steward.debug new file mode 100755 index 0000000..12c89dc --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/start-steward.debug | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | DIR=`dirname $0` | ||
4 | |||
5 | if [ ! -f $DIR/server.js ]; then | ||
6 | echo "$0: Cannot find $DIR/server.js" | ||
7 | exit -1 | ||
8 | fi | ||
9 | |||
10 | if [ -z "$THE_THING_SYSTEM" ]; then | ||
11 | THE_THING_SYSTEM=/opt/TheThingSystem | ||
12 | export THE_THING_SYSTEM | ||
13 | fi | ||
14 | |||
15 | if [ -z "$NODE_PATH" ]; then | ||
16 | NODE_PATH=${THE_THING_SYSTEM}/steward | ||
17 | export NODE_PATH | ||
18 | fi | ||
19 | |||
20 | cd $DIR | ||
21 | DEBUG=hci-ble node $DIR/server.js $@ | ||
22 | exit $? | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward/steward.service.in b/meta-iot/recipes-web/the-thing-system/steward/steward.service.in new file mode 100644 index 0000000..894f29a --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward/steward.service.in | |||
@@ -0,0 +1,12 @@ | |||
1 | [Unit] | ||
2 | Description=Steward for TheThingSystem | ||
3 | After=steward-init.service | ||
4 | |||
5 | [Service] | ||
6 | Type=simple | ||
7 | EnvironmentFile=-/etc/TheThingSystem/config | ||
8 | ExecStart=@the_thing_system_dir@/steward/start-steward | ||
9 | Restart=on-failure | ||
10 | |||
11 | [Install] | ||
12 | WantedBy=multi-user.target | ||
diff --git a/meta-iot/recipes-web/the-thing-system/steward_git.bb b/meta-iot/recipes-web/the-thing-system/steward_git.bb new file mode 100644 index 0000000..616435c --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/steward_git.bb | |||
@@ -0,0 +1,131 @@ | |||
1 | DESCRIPTION = "The Thing System steward" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=2fe93140f8c4e56b56fbcd64730767a4" | ||
4 | |||
5 | SRC_URI = "\ | ||
6 | git://github.com/TheThingSystem/steward.git \ | ||
7 | file://steward.service.in \ | ||
8 | file://start-steward \ | ||
9 | file://start-steward.debug \ | ||
10 | file://server.js.in \ | ||
11 | file://package.json \ | ||
12 | " | ||
13 | |||
14 | SRCREV = "cc38554aea4bdebcf55d11ca516711abbfc7ec73" | ||
15 | S = "${WORKDIR}/git" | ||
16 | PR = "r9" | ||
17 | PV = "1.7+git${SRCPV}" | ||
18 | |||
19 | DEPENDS = "tts-nodejs-native" | ||
20 | DEPENDS_${PN} = "\ | ||
21 | libdns-sd-dev \ | ||
22 | libpcap-dev \ | ||
23 | libusb1 \ | ||
24 | libbluetooth-dev \ | ||
25 | ${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd-dev', 'libudev-dev', d)} \ | ||
26 | " | ||
27 | |||
28 | THE_THING_SYSTEM ?= "/opt/TheThingSystem" | ||
29 | |||
30 | inherit systemd | ||
31 | |||
32 | SYSTEMD_PACKAGES = "${PN}" | ||
33 | SYSTEMD_SERVICE_${PN} = "steward.service" | ||
34 | |||
35 | FILES_${PN} = "\ | ||
36 | ${THE_THING_SYSTEM}/* \ | ||
37 | ${libdir} \ | ||
38 | " | ||
39 | |||
40 | FILES_${PN}-dbg += "\ | ||
41 | ${THE_THING_SYSTEM}/steward/*/*/*/.debug \ | ||
42 | ${THE_THING_SYSTEM}/steward/*/*/*/*/.debug \ | ||
43 | ${THE_THING_SYSTEM}/steward/*/*/*/*/*/.debug \ | ||
44 | ${THE_THING_SYSTEM}/steward/*/*/*/*/*/*/.debug \ | ||
45 | ${THE_THING_SYSTEM}/steward/*/*/*/*/*/*/*/.debug \ | ||
46 | ${THE_THING_SYSTEM}/steward/*/*/*/*/*/*/*/*/.debug \ | ||
47 | ${THE_THING_SYSTEM}/steward/*/*/*/*/*/*/*/*/*/.debug \ | ||
48 | " | ||
49 | |||
50 | RDEPENDS_${PN} = "openssl tts-nodejs steward-init ruby" | ||
51 | |||
52 | def get_arch(bb, d): | ||
53 | val = (bb.data.getVar("MACHINEOVERRIDES", d) or "") | ||
54 | if val.find("genericx86") > 0: | ||
55 | return "--arch=i686" | ||
56 | elif val.find("x86") > 0: | ||
57 | return "--arch=i686" | ||
58 | elif val.find("arm") > 0: | ||
59 | return "--arch=arm" | ||
60 | else: | ||
61 | return "" | ||
62 | |||
63 | # Always compile 32-bit in npm because many modules that npm | ||
64 | # compiles do not support 64 bit in x86. | ||
65 | TTS_ARCH := "${@get_arch(bb, d)}" | ||
66 | |||
67 | do_install_append() { | ||
68 | # Some python issue prevents installation if the current | ||
69 | # user id is not in sysroots /etc/passwd file. So add user | ||
70 | # information there (this is actually quite ugly hack) | ||
71 | # See http://bugs.python.org/issue10496 for details. | ||
72 | PASSLINE=`grep \`echo ${HOME}|cut -d / -f 3\` /etc/passwd`; \ | ||
73 | grep "'${PASSLINE}'" ${PKG_CONFIG_SYSROOT_DIR}/etc/passwd || \ | ||
74 | echo "${PASSLINE}" >> ${PKG_CONFIG_SYSROOT_DIR}/etc/passwd | ||
75 | |||
76 | install -d ${D}${THE_THING_SYSTEM}/steward | ||
77 | install -d ${D}${systemd_unitdir}/system | ||
78 | install -m 0755 ${WORKDIR}/start-steward ${D}${THE_THING_SYSTEM}/steward | ||
79 | install -m 0755 ${WORKDIR}/start-steward.debug ${D}${THE_THING_SYSTEM}/steward | ||
80 | |||
81 | sed 's,@the_thing_system_dir@,${THE_THING_SYSTEM},g' \ | ||
82 | < ${WORKDIR}/steward.service.in \ | ||
83 | > ${D}${systemd_unitdir}/system/steward.service | ||
84 | sed 's,@the_thing_system_dir@,${THE_THING_SYSTEM},g' \ | ||
85 | < ${WORKDIR}/server.js.in \ | ||
86 | > ${D}${THE_THING_SYSTEM}/steward/server.js | ||
87 | |||
88 | cp -pR ${S}/steward/* ${D}${THE_THING_SYSTEM}/steward/ | ||
89 | install -m 0644 ${WORKDIR}/package.json ${D}${THE_THING_SYSTEM}/steward | ||
90 | rm -rf ${D}${THE_THING_SYSTEM}/steward/sandbox/js-beautify-master/tests | ||
91 | rm ${D}${THE_THING_SYSTEM}/steward/run.sh | ||
92 | find ${D}${THE_THING_SYSTEM} -name .gitignore -exec rm '{}' \; | ||
93 | |||
94 | # Setup the node.js environment | ||
95 | cd ${D}${THE_THING_SYSTEM}/steward | ||
96 | |||
97 | # There seems to be some issues (npm hanging) if you try to run | ||
98 | # install when behind the proxy. So we try to setup proxies for npm | ||
99 | # See README.iot file for details. | ||
100 | if [ -x ~/npm-setup-proxies ]; then ~/npm-setup-proxies; fi | ||
101 | |||
102 | # Cleaning cache should help to some weird compilation errors | ||
103 | npm cache clean | ||
104 | |||
105 | # Do a fresh start | ||
106 | rm -rf node_modules | ||
107 | |||
108 | # Telling npm to use known registrars will prevent this error | ||
109 | # | npm ERR! Error: SSL Error: SELF_SIGNED_CERT_IN_CHAIN | ||
110 | # when running npm | ||
111 | npm config set ca "" | ||
112 | |||
113 | # Some of the node.js packages put -pthreads into ld params and ld | ||
114 | # does not understand it. So install packages using gcc as a linker. | ||
115 | LD=${TARGET_PREFIX}gcc npm install --production -l ${TTS_ARCH} | ||
116 | |||
117 | # No need for static libraries | ||
118 | find ${D}${THE_THING_SYSTEM} -name '*.a' -exec rm '{}' \; | ||
119 | |||
120 | # Remove not used files | ||
121 | rm -rf ${D}${THE_THING_SYSTEM}/steward/node_modules/xml2js/node_modules/sax/examples | ||
122 | rm -rf ${D}${THE_THING_SYSTEM}/steward/node_modules/openzwave/deps/open-zwave/debian | ||
123 | |||
124 | # Remove some garbage files that prevent image creation | ||
125 | rm -f ${D}${THE_THING_SYSTEM}/steward/node_modules/pcap/*%* | ||
126 | |||
127 | # Blinkstick does not load in this version so just remove it | ||
128 | rm -rf ${D}${THE_THING_SYSTEM}/steward/node_modules/blinkstick | ||
129 | rm -rf ${D}${THE_THING_SYSTEM}/steward/devices/devices-lighting/lighting-blinkstick-led.js | ||
130 | |||
131 | } | ||
diff --git a/meta-iot/recipes-web/the-thing-system/tts-nodejs_git.bb b/meta-iot/recipes-web/the-thing-system/tts-nodejs_git.bb new file mode 100644 index 0000000..813526e --- /dev/null +++ b/meta-iot/recipes-web/the-thing-system/tts-nodejs_git.bb | |||
@@ -0,0 +1,49 @@ | |||
1 | DESCRIPTION = "Node.js is a server-side JavaScript environment for TheThingSystem" | ||
2 | LICENSE = "MIT & BSD" | ||
3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=4a31e6c424761191227143b86f58a1ef" | ||
4 | |||
5 | S = "${WORKDIR}/git" | ||
6 | SRCREV = "cc56c62ed879ad4f93b1fdab3235c43e60f48b7e" | ||
7 | PV = "0.10.26" | ||
8 | |||
9 | SRC_URI = "\ | ||
10 | git://github.com/joyent/node.git;branch=v0.10.26-release \ | ||
11 | " | ||
12 | |||
13 | THE_THING_SYSTEM ?= "/opt/TheThingSystem" | ||
14 | |||
15 | DEPENDS = "openssl ninja-native" | ||
16 | |||
17 | # v8 errors out if you have set CCACHE | ||
18 | CCACHE = "" | ||
19 | |||
20 | ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard',\ | ||
21 | '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)}" | ||
22 | ARCHFLAGS ?= "" | ||
23 | |||
24 | do_configure() { | ||
25 | export LD="${CXX}" | ||
26 | ./configure --ninja --prefix=${prefix} --without-snapshot ${ARCHFLAGS} | ||
27 | } | ||
28 | |||
29 | do_compile() { | ||
30 | export LD="${CXX}" | ||
31 | make BUILDTYPE=Release | ||
32 | } | ||
33 | |||
34 | do_install() { | ||
35 | oe_runmake install DESTDIR=${D} | ||
36 | } | ||
37 | |||
38 | FILES_${PN} = "\ | ||
39 | ${libdir} \ | ||
40 | ${bindir} \ | ||
41 | " | ||
42 | |||
43 | RDEPENDS_${PN} = "curl python-shell python-datetime python-subprocess \ | ||
44 | python-crypt python-textutils python-netclient \ | ||
45 | python-misc python-multiprocessing \ | ||
46 | " | ||
47 | RDEPENDS_${PN}_class-native = "" | ||
48 | |||
49 | BBCLASSEXTEND = "native" | ||