Browse Source

node-mozilla-iot-gateway: Remove package

As the WebThings Gateway moves into a full-fledged router
distribution, it no longer makes sense to have this as a
standalone package, as it now modifies system-wide settings.

References #9629
References mozilla-iot/gateway#2060
References https://gitlab.labs.nic.cz/turris/turris-os-packages/issues/452

Signed-off-by: Michael Stegeman <michael@stegeman.me>
lilik-openwrt-22.03
Michael Stegeman 5 years ago
parent
commit
ebc394b2cc
No known key found for this signature in database GPG Key ID: FEDD596D296F7400
4 changed files with 0 additions and 256 deletions
  1. +0
    -9
      lang/node-mozilla-iot-gateway/Config.in
  2. +0
    -76
      lang/node-mozilla-iot-gateway/Makefile
  3. +0
    -150
      lang/node-mozilla-iot-gateway/README.md
  4. +0
    -21
      lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init

+ 0
- 9
lang/node-mozilla-iot-gateway/Config.in View File

@ -1,9 +0,0 @@
if PACKAGE_node-mozilla-iot-gateway
comment "Optional features"
config MOIT_enable-plugin-support
bool "Enable packages needed for some plugins"
default y
endif

+ 0
- 76
lang/node-mozilla-iot-gateway/Makefile View File

@ -1,76 +0,0 @@
#
# Copyright (C) 2018 Sartura Ltd.
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NPM_NAME:=mozilla-iot-gateway
PKG_NAME:=node-$(PKG_NPM_NAME)
PKG_VERSION:=0.8.1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/mozilla-iot/gateway/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=f407732b9c1d020aa79e9d0b12f1b97e82691d6f58def2df067f790f4f640e30
PKG_BUILD_DEPENDS:=node/host openzwave
PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
PKG_LICENSE:=MPL-2.0
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/node-mozilla-iot-gateway
SUBMENU:=Node.js
SECTION:=lang
CATEGORY:=Languages
TITLE:=WebThings Gateway by Mozilla
URL:=https://iot.mozilla.org/gateway/
DEPENDS:= +libpthread +node +node-npm +libopenzwave +openzwave-config +python +python3-light +python3-pip +openssl-util
DEPENDS+= +MOIT_enable-plugin-support:git-http
MENU:=1
endef
define Package/node-mozilla-iot-gateway/description
Build Your Own Web of Things Gateway. The "Web of Things" (WoT) is the
idea of taking the lessons learned from the World Wide Web and applying
them to IoT. It's about creating a decentralized Internet of Things by
giving Things URLs on the web to make them linkable and discoverable,
and defining a standard data model and APIs to make them interoperable.
endef
define Package/node-mozilla-iot-gateway/config
source "$(SOURCE)/Config.in"
endef
CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH)))))
TARGET_CFLAGS+=$(FPIC)
define Build/Compile
$(MAKE_VARS) \
$(MAKE_FLAGS) \
npm_config_arch=$(CONFIG_ARCH) \
npm_config_nodedir=$(STAGING_DIR)/usr/ \
npm_config_cache=$(TMP_DIR)/npm-cache \
npm_config_tmp=$(TMP_DIR)/npm-tmp \
PREFIX="$(PKG_INSTALL_DIR)/usr/" \
$(STAGING_DIR_HOSTPKG)/bin/npm install --build-from-source --target_arch=$(CPU) -g $(DL_DIR)/$(PKG_SOURCE)
endef
define Package/node-mozilla-iot-gateway/install
$(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/webthings-gateway/* $(1)/opt/mozilla-iot/gateway
$(MAKE_VARS) \
$(MAKE_FLAGS) \
$(STAGING_DIR_HOSTPKG)/bin/npm --prefix=$(1)/opt/mozilla-iot/gateway install \
--build-from-source --target_arch=$(CPU) $(1)/opt/mozilla-iot/gateway
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/mozilla-iot-gateway.init $(1)/etc/init.d/mozilla-iot-gateway
endef
$(eval $(call BuildPackage,node-mozilla-iot-gateway))

+ 0
- 150
lang/node-mozilla-iot-gateway/README.md View File

@ -1,150 +0,0 @@
# Things Gateway by Mozilla
Build Your Own Web of Things Gateway. The "Web of Things" (WoT) is the idea of
taking the lessons learned from the World Wide Web and applying them to IoT.
It's about creating a decentralized Internet of Things by giving Things URLs on
the web to make them linkable and discoverable, and defining a standard data
model and APIs to make them interoperable.
### Getting Started
These instructions will get you a copy of OpenWrt's build system on your local
machine for development and testing purposes. To check the prerequisites for
your system check out this
[link](https://openwrt.org/docs/guide-developer/build-system/install-buildsystem).
```
git clone https://github.com/openwrt/openwrt
cd openwrt
```
### Configure the build system
We need to configure the build system and select the Things Gateway package.
This process is no different from selecting other OpenWrt packages. For this
example we will be using build configuration for Raspberry Pi 2/3.
Update feeds and open menuconfig interface:
```
make package/symlinks
make menuconfig
```
Select your target:
```
Target System (Broadcom BCM27xx) --->
Subtarget (BCM2709/BCM2710 32 bit based boards) --->
Target Profile (Raspberry Pi 2B/3B/3B+/3CM) --->
```
Things Gateway package is a bit beefy. In order to fit the image, extend the
filesystem size from 256 to 1024 MB:
```
Target Images --->
(1024) Root filesystem partition size (in MB)
```
Select Things Gateway package:
```
Languages --->
Node.js --->
<*> node-mozilla-iot-gateway
```
Save and exit.
### Building the image
Run the build process and substitute <N> with the number of your CPU cores:
```
make -j<N>
```
### Flashing on the SD card
Process of flashing the image will depend on which device you have.
Instructions below are for Raspberry Pi 2/3. For other devices consult OpenWrt
wiki pages. Be careful to replace the X in the third command with the drive
letter of your SD card.
```
cd bin/targets/brcm2708/bcm2709
gunzip openwrt-brcm2708-bcm2709-rpi-2-ext4-factory.img.gz
sudo dd if=openwrt-brcm2708-bcm2709-rpi-2-ext4-factory.img of=/dev/sdX conv=fsync
```
## Running Things Gateway from USB flash drive
In case the device doesn't have enough internal storage space, it is possible
to run Things Gateway of a USB flash drive. This requires USB flash drive with
ext4 filesystem plugged in the device.
### Configuration
Do all steps from "Configure the build system" above, and after that change
node-mozilla-iot-gateway selection from "\*" to "M". This will build the
package and all of it's dependencies but it will not install Things Gateway.
```
Languages --->
Node.js --->
<M> node-mozilla-iot-gateway
```
### Prepare the device
We need to auto mount the USB flash drive in order for the gateway to start at
boot. To do so, open a console on your embedded device and create a /etc/fstab
file with the following contents. This assumes your USB flash drive is
/dev/sda1:
```
/dev/sda1 /opt ext4 rw,relatime,data=ordered 0 1
/opt/root /root none defaults,bind 0 0
```
Add "mount -a" to the end of the "boot" function in /etc/init.d/boot
```
boot() {
.
.
.
/bin/config_generate
uci_apply_defaults
# temporary hack until configd exists
/sbin/reload_config
# Added by us
mount -a
}
```
### Install Things Gateway package
After successfully mounting the USB drive, transfer the .ipk file from your
local machine to the device and install it. Note that your package version
might defer. Also note that location of .ipk file depends on the selected
target, but it will be within ./bin/packages directory. We need to use
"--force-space" or else opkg might complain about insufficient space.
On your local machine:
```
cd bin/packages/arm_cortex-a9_vfpv3/packages/
scp node-mozilla-iot-gateway_0.6.0-1_arm_cortex-a9_vfpv3.ipk root@192.168.1.1:/tmp
```
On the device:
```
opkg --force-space install /tmp/node-mozilla-iot-gateway_0.6.0-1_arm_cortex-a9_vfpv3.ipk
```
Things Gateway should now start at every boot.

+ 0
- 21
lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init View File

@ -1,21 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
HOME=/root
MOZIOT_HOME="${HOME}/.mozilla-iot"
export PATH="/opt/mozilla-iot/gateway/tools:${PATH}"
start_service()
{
mkdir -p /usr/etc/
ln -sf /etc/openzwave /usr/etc/openzwave
procd_open_instance mozilla-iot-gateway
procd_set_param command /usr/bin/npm start --prefix /opt/mozilla-iot/gateway
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}

Loading…
Cancel
Save