From 8487a8a347075899b82abaf717b24e0789a8cc5b Mon Sep 17 00:00:00 2001
From: Michal Hrusecky <Michal@Hrusecky.net>
Date: Sun, 5 May 2019 07:05:11 +0200
Subject: [PATCH] mozilla-iot-gateway: Rebase integration patch

---
 ...zilla-iot-gateway-Better-integration.patch | 70 ++++++-------------
 1 file changed, 20 insertions(+), 50 deletions(-)

diff --git a/patches/packages/branding/0004-mozilla-iot-gateway-Better-integration.patch b/patches/packages/branding/0004-mozilla-iot-gateway-Better-integration.patch
index 6020db728..12786f0b9 100644
--- a/patches/packages/branding/0004-mozilla-iot-gateway-Better-integration.patch
+++ b/patches/packages/branding/0004-mozilla-iot-gateway-Better-integration.patch
@@ -1,54 +1,48 @@
-From 3ee62cae6b8d2fc74d397e8ef382056b27bef771 Mon Sep 17 00:00:00 2001
+From 8fb19ec8f816dcceed2e587d913245ebf87973d5 Mon Sep 17 00:00:00 2001
 From: Michal Hrusecky <michal.hrusecky@nic.cz>
 Date: Thu, 28 Mar 2019 17:46:18 +0100
 Subject: [PATCH] mozilla-iot-gateway: Better integration
 
 ---
- lang/node-mozilla-iot-gateway/Makefile        | 31 +++++++++++--------
- .../files/mozilla-iot-gateway.init            |  6 ++--
- 2 files changed, 21 insertions(+), 16 deletions(-)
+ lang/node-mozilla-iot-gateway/Makefile | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
 
 diff --git a/lang/node-mozilla-iot-gateway/Makefile b/lang/node-mozilla-iot-gateway/Makefile
-index c555edb..3aeb671 100644
+index 3289a05..d735dda 100644
 --- a/lang/node-mozilla-iot-gateway/Makefile
 +++ b/lang/node-mozilla-iot-gateway/Makefile
-@@ -34,7 +34,7 @@ define Package/node-mozilla-iot-gateway
+@@ -30,7 +30,7 @@ define Package/node-mozilla-iot-gateway
    CATEGORY:=Languages
-   TITLE:=Things Gateway by Mozilla
+   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:= +libpthread +node +node-npm +libopenzwave +openzwave-config +python +python3-light +python3-pip +openssl-util +mozilla-iot-gateway-webapp
    DEPENDS+= +MOIT_enable-plugin-support:git-http
    MENU:=1
  endef
-@@ -65,18 +65,23 @@ define Build/Compile
+@@ -63,18 +63,23 @@ define Build/Compile
  endef
  
  define Package/node-mozilla-iot-gateway/install
 -	$(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway/
--	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/* $(1)/opt/mozilla-iot/gateway
+-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/webthings-gateway/* $(1)/opt/mozilla-iot/gateway
 -	$(STAGING_DIR_HOSTPKG)/bin/npm --prefix=$(1)/opt/mozilla-iot/gateway install $(1)/opt/mozilla-iot/gateway
--
--	# Clean up of old build files that confuse OpenWrt's dependency checker
--	$(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-x64
--	$(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/ursa-optional/build/Release/ursaNative.node
--	$(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/ursa-optional/build/Release/obj.target/ursaNative.node
--
--	$(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
--	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/node_sqlite3.node \
--		$(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
 +	$(INSTALL_DIR) $(1)/srv/mozilla-iot/gateway/
 +	$(INSTALL_DIR) $(1)/srv/mozilla-iot-home
-+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/* $(1)/srv/mozilla-iot/gateway
++	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/webthings-gateway/* $(1)/srv/mozilla-iot/gateway
 +	$(STAGING_DIR_HOSTPKG)/bin/npm --prefix=$(1)/srv/mozilla-iot/gateway install $(1)/srv/mozilla-iot/gateway
-+ 
-+ 	# Clean up of old build files that confuse OpenWrt's dependency checker
+ 
+ 	# Clean up of old build files that confuse OpenWrt's dependency checker
+-	$(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-x64
+-	$(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/ursa/build/Release/ursaNative.node
+-	$(RM) -r $(1)/opt/mozilla-iot/gateway/node_modules/ursa/build/Release/obj.target/ursaNative.node
 +	$(RM) -r $(1)/srv/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-x64
-+	$(RM) -r $(1)/srv/mozilla-iot/gateway/node_modules/ursa-optional/build/Release/ursaNative.node
-+	$(RM) -r $(1)/srv/mozilla-iot/gateway/node_modules/ursa-optional/build/Release/obj.target/ursaNative.node
-+ 
-+	$(INSTALL_DIR) $(1)/srv/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
-+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/node_sqlite3.node \
++	$(RM) -r $(1)/srv/mozilla-iot/gateway/node_modules/ursa/build/Release/ursaNative.node
++	$(RM) -r $(1)/srv/mozilla-iot/gateway/node_modules/ursa/build/Release/obj.target/ursaNative.node
+ 
+ 	$(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
+ 	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/webthings-gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/node_sqlite3.node \
+-		$(1)/opt/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
 +		$(1)/srv/mozilla-iot/gateway/node_modules/sqlite3/lib/binding/node-v57-linux-$(CPU)/
 +
 +	# Custom configuration
@@ -57,30 +51,6 @@ index c555edb..3aeb671 100644
  
  	$(INSTALL_DIR) $(1)/etc/init.d
  	$(INSTALL_BIN) ./files/mozilla-iot-gateway.init $(1)/etc/init.d/mozilla-iot-gateway
-diff --git a/lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init b/lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init
-index 8ed67fc..a942b0b 100644
---- a/lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init
-+++ b/lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init
-@@ -4,8 +4,8 @@ START=99
- 
- USE_PROCD=1
- 
--HOME=/root
--MOZIOT_HOME="${HOME}/.mozilla-iot"
-+export HOME=/srv/mozilla-iot-home
-+export MOZIOT_HOME="${HOME}/.mozilla-iot"
- export PATH="/opt/mozilla-iot/gateway/tools:${PATH}"
- 
- start_service()
-@@ -14,7 +14,7 @@ start_service()
- 	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 command /usr/bin/npm start --prefix /srv/mozilla-iot/gateway
- 	procd_set_param stdout 1
- 	procd_set_param stderr 1
- 	procd_close_instance
 -- 
 2.21.0
 
-- 
GitLab