From: Stijn Tintel Date: Mon, 30 Jan 2017 23:37:24 +0000 (+0100) Subject: domoticz: new package X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=042933714af6440eb38728b5ade18d5d70855ee4;p=feed%2Fpackages.git domoticz: new package Signed-off-by: David Woodhouse Signed-off-by: Stijn Tintel --- diff --git a/utils/domoticz/Makefile b/utils/domoticz/Makefile new file mode 100644 index 0000000000..4a350dbceb --- /dev/null +++ b/utils/domoticz/Makefile @@ -0,0 +1,100 @@ +# +# Copyright (C) 2016 - 2017 Stijn Tintel +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=domoticz +PKG_VERSION_MAJOR:=3 +PKG_VERSION_PATCH:=5877 +PKG_VERSION:=$(PKG_VERSION_MAJOR).$(PKG_VERSION_PATCH) +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/archive/$(PKG_VERSION)/$(PKG_SOURCE) +PKG_HASH:=fb88edbe428851a7a337a85faa93f6da00713b3ad086ff6957031dc9b3b58bba + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=License.txt + +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/domoticz + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Open Source Home Automation System + URL:=http://domoticz.com/ + MAINTAINER:=Stijn Tintel + USERID:=domoticz=6144:domoticz=6144 + DEPENDS:= \ + +boost \ + +boost-date_time \ + +boost-system \ + +boost-thread \ + +libcurl \ + +libmosquittopp \ + +libopenssl \ + +libopenzwave \ + +libsqlite3 \ + +libstdcpp \ + +zlib +endef + +define Package/domoticz/description + Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device. +endef + +CMAKE_OPTIONS += \ + -DCMAKE_BUILD_TYPE=Release \ + -DUSE_BUILTIN_MQTT=no \ + -DUSE_BUILTIN_SQLITE=no \ + -DUSE_STATIC_BOOST=no \ + -DUSE_STATIC_LIBSTDCXX=no \ + -DUSE_STATIC_OPENZWAVE=no \ + -DUSE_PYTHON=no + +define Build/Prepare + $(call Build/Prepare/Default) + # Fix APPVERSION to suppress update popup + sed -i 's/#define APPVERSION.*/#define APPVERSION $(PKG_VERSION_PATCH)/' \ + $(PKG_BUILD_DIR)/appversion.default + # Remove unwanted scripts + cd $(PKG_BUILD_DIR)/scripts && rm -rf \ + buienradar_rain_example.pl \ + _domoticz_main.bat \ + download_update.sh \ + logrotate/ \ + python/ \ + readme.txt \ + restart_domoticz \ + templates/All.Python \ + update_domoticz +endef + +define Package/domoticz/install + $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/tty $(1)/etc/init.d + $(INSTALL_BIN) ./files/domoticz.hotplug $(1)/etc/hotplug.d/tty/domoticz + $(INSTALL_BIN) ./files/domoticz.init $(1)/etc/init.d/domoticz + $(INSTALL_CONF) ./files/domoticz.config $(1)/etc/config/domoticz + $(INSTALL_DIR) $(1)/usr/share/domoticz $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/Config $(1)/usr/share/domoticz/openzwave + $(CP) $(PKG_INSTALL_DIR)/usr/scripts $(1)/usr/share/domoticz/ + $(CP) $(PKG_INSTALL_DIR)/usr/www $(1)/usr/share/domoticz/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/domoticz $(1)/usr/bin/domoticz +endef + +define Package/domoticz/conffiles +/etc/config/domoticz +/var/lib/domoticz/ +endef + +$(eval $(call BuildPackage,domoticz)) diff --git a/utils/domoticz/files/domoticz.config b/utils/domoticz/files/domoticz.config new file mode 100644 index 0000000000..b300f3f2d7 --- /dev/null +++ b/utils/domoticz/files/domoticz.config @@ -0,0 +1,28 @@ +config domoticz + option disabled '1' + option loglevel '1' + option syslog 'daemon' + # option sslcert '/path/to/ssl.crt' + # option sslkey '/path/to/ssl.key' + # option sslpass 'passphrase' + option sslwww '0' + # CAUTION - by default, /var is not persistent accross reboots + # Don't forget the trailing / - domoticz requires it + option userdata '/var/lib/domoticz/' + +#config device +# option product '658/200/0' +# option symlink 'ttyACM-aeotec-zstick-g5' + +#config device +# option serial '526359' +# option symlink 'ttyUSB-serial' + +#config device +# option usbif '2-1:1.0' +# option symlink 'ttyUSB-port1' + +#config device +# option product '67b/2303/202' +# option usbif '2-2:1.0' +# option symlink 'ttyUSB-port2' diff --git a/utils/domoticz/files/domoticz.hotplug b/utils/domoticz/files/domoticz.hotplug new file mode 100644 index 0000000000..7138175ef0 --- /dev/null +++ b/utils/domoticz/files/domoticz.hotplug @@ -0,0 +1,44 @@ +#!/bin/sh + +. /lib/functions.sh + +[ "$SUBSYSTEM" = "tty" ] || exit 0 + +add() { + local cfg="$1" + local product serial symlink usbif + + [ -c "/dev/$DEVICENAME" ] || return + + config_get product "$cfg" product + config_get serial "$cfg" serial + config_get symlink "$cfg" symlink + config_get usbif "$cfg" usbif + + [ -z "$product" -a -z "$serial" -a -z "$usbif" ] && return + + . "/sys/$DEVPATH/device/../uevent" + SERIAL="$(cat /sys/$DEVPATH/device/../../serial)" 2>/dev/null + USBIF="$(echo $DEVPATH | awk -F/ 'BEGIN {i=3}; /ACM/ {i=2}; END {print $(NF-i)}')" + + [ -n "$product" -a "$product" != "$PRODUCT" ] && return + [ -n "$serial" -a "$serial" != "$SERIAL" ] && return + [ -n "$usbif" -a "$usbif" != "$USBIF" ] && return + + chgrp domoticz "/dev/$DEVICENAME" + chmod g+rw "/dev/$DEVICENAME" + + [ -n "$symlink" ] && ln -s "/dev/$DEVICENAME" "/dev/$symlink" +} + +remove() { + local cfg="$1" + local symlink + + config_get symlink "$cfg" symlink + + [ "/dev/$DEVICENAME" = "$(readlink /dev/$symlink)" ] && rm "/dev/$symlink" +} + +config_load "domoticz" +config_foreach "$ACTION" device diff --git a/utils/domoticz/files/domoticz.init b/utils/domoticz/files/domoticz.init new file mode 100644 index 0000000000..cbee77b5cf --- /dev/null +++ b/utils/domoticz/files/domoticz.init @@ -0,0 +1,54 @@ +#!/bin/sh /etc/rc.common + +START=99 +USE_PROCD=1 +PROG=/usr/bin/domoticz +PIDFILE=/var/run/domoticz.pid + +start_domoticz() { + local section="$1" + local loglevel sslcert sslpass sslwww syslog userdata + + config_get loglevel "$section" "loglevel" + config_get sslcert "$section" "sslcert" + config_get sslkey "$section" "sslkey" + config_get sslpass "$section" "sslpass" + config_get sslwww "$section" "sslwww" + config_get syslog "$section" "syslog" + config_get userdata "$section" "userdata" + + [ -n "$loglevel" ] && procd_append_param command -loglevel "$loglevel" + [ -n "$syslog" ] && procd_append_param command -syslog "$syslog" + [ -n "$userdata" ] && procd_append_param command -userdata "$userdata" + [ -n "$sslcert" -a "${sslwww:-0}" -gt 0 ] && { + procd_append_param command -sslcert "$sslcert" + procd_append_param command -sslwww "$sslwww" + [ -n "$sslkey" ] && procd_append_param command -sslkey "$sslkey" + [ -n "$sslpass" ] && procd_append_param command -sslpass "$sslpass" + } || procd_append_param command -sslwww 0 +} + +start_service() { + mkdir -p /var/lib/domoticz + chmod 0770 /var/lib/domoticz + chown domoticz:domoticz /var/lib/domoticz + + procd_open_instance + + procd_set_param command "$PROG" + procd_append_param command -scripts /usr/share/domoticz/scripts/ + procd_append_param command -wwwroot /usr/share/domoticz/www/ + + config_load "domoticz" + config_get_bool disabled "$section" "disabled" 0 + [ "$disabled" -gt 0 ] && return 1 + config_foreach start_domoticz domoticz + + procd_set_param pidfile "$PIDFILE" + procd_set_param respawn + procd_set_param stdout 0 + procd_set_param term_timeout 10 + procd_set_param user "domoticz" + + procd_close_instance +} diff --git a/utils/domoticz/patches/001-Add-sslkey-option-to-allow-separate-cert-key-files-1.patch b/utils/domoticz/patches/001-Add-sslkey-option-to-allow-separate-cert-key-files-1.patch new file mode 100644 index 0000000000..3e734655e5 --- /dev/null +++ b/utils/domoticz/patches/001-Add-sslkey-option-to-allow-separate-cert-key-files-1.patch @@ -0,0 +1,48 @@ +From 2504f02de752aceb5a3c1d4749032147efde8082 Mon Sep 17 00:00:00 2001 +From: dwmw2 +Date: Fri, 3 Feb 2017 07:40:35 +0000 +Subject: [PATCH] Add -sslkey option to allow separate cert/key files (#1195) + +--- + main/domoticz.cpp | 11 +++++++++++ + webserver/server_settings.hpp | 2 +- + 2 files changed, 12 insertions(+), 1 deletion(-) + +--- a/main/domoticz.cpp ++++ b/main/domoticz.cpp +@@ -76,6 +76,7 @@ const char *szHelp= + #ifdef WWW_ENABLE_SSL + "\t-sslwww port (for example -sslwww 443, or -sslwww 0 to disable https)\n" + "\t-sslcert file_path (for example /opt/domoticz/server_cert.pem)\n" ++ "\t-sslkey file_path (if different from certificate file)\n" + "\t-sslpass passphrase (to access to server private key in certificate)\n" + "\t-sslmethod method (for SSL method)\n" + "\t-ssloptions options (for SSL options, default is 'default_workarounds,no_sslv2,single_dh_use')\n" +@@ -682,6 +683,16 @@ int main(int argc, char**argv) + return 1; + } + secure_webserver_settings.cert_file_path = cmdLine.GetSafeArgument("-sslcert", 0, ""); ++ secure_webserver_settings.private_key_file_path = secure_webserver_settings.cert_file_path; ++ } ++ if (cmdLine.HasSwitch("-sslkey")) ++ { ++ if (cmdLine.GetArgumentCount("-sslkey") != 1) ++ { ++ _log.Log(LOG_ERROR, "Please specify a file path for your server SSL key file"); ++ return 1; ++ } ++ secure_webserver_settings.private_key_file_path = cmdLine.GetSafeArgument("-sslkey", 0, ""); + } + if (cmdLine.HasSwitch("-sslpass")) + { +--- a/webserver/server_settings.hpp ++++ b/webserver/server_settings.hpp +@@ -227,7 +227,7 @@ public: + // use certificate file for all usage by default + certificate_chain_file_path = ssl_settings.cert_file_path; + ca_cert_file_path = ssl_settings.cert_file_path; +- private_key_file_path = ssl_settings.cert_file_path; ++ private_key_file_path = ssl_settings.private_key_file_path; + tmp_dh_file_path = ssl_settings.cert_file_path; + verify_file_path = ssl_settings.cert_file_path; + } diff --git a/utils/domoticz/patches/002-Evohome-updates-to-6708.patch b/utils/domoticz/patches/002-Evohome-updates-to-6708.patch new file mode 100644 index 0000000000..bf8d6ae591 --- /dev/null +++ b/utils/domoticz/patches/002-Evohome-updates-to-6708.patch @@ -0,0 +1,68 @@ +diff --git a/hardware/evohome.cpp b/hardware/evohome.cpp +index fcbee6d..f77291e 100644 +--- a/hardware/evohome.cpp ++++ b/hardware/evohome.cpp +@@ -423,11 +423,11 @@ void CEvohome::RunScript(const char *pdata, const unsigned char length) + boost::replace_all(OnAction, "{state}", s_strid.str()); + boost::replace_all(OnAction, "{until}", CEvohomeDateTime::GetISODate(tsen->EVOHOME2)); + //Execute possible script +- std::string scriptname; +- if (OnAction.find("script:///") != std::string::npos) +- scriptname = OnAction.substr(9); +- else +- scriptname = OnAction.substr(8); ++ std::string scriptname = OnAction.substr(9); ++#if !defined WIN32 ++ if (scriptname.find("/") != 0) ++ scriptname = szUserDataFolder + "scripts/" + scriptname; ++#endif + std::string scriptparams=""; + //Add parameters + int pindex=scriptname.find(' '); +@@ -439,7 +439,7 @@ void CEvohome::RunScript(const char *pdata, const unsigned char length) + + if (file_exist(scriptname.c_str())) + { +- m_sql.AddTaskItem(_tTaskItem::ExecuteScript(1,scriptname,scriptparams)); ++ m_sql.AddTaskItem(_tTaskItem::ExecuteScript(0.2f,scriptname,scriptparams)); + } + else + _log.Log(LOG_ERROR,"evohome: Error script not found '%s'",scriptname.c_str()); +@@ -1321,7 +1321,7 @@ bool CEvohome::DecodeZoneName(CEvohomeMsg &msg) + } + if(memcmp(&msg.payload[2],m_szNameErr,18)==0) + { +- Log(true,LOG_STATUS,"evohome: %s: Warning zone name not set: %d", tag, msg.payload[0]); ++ Log(true,LOG_STATUS,"evohome: %s: Warning zone name not set: %d", tag, msg.payload[0]+1); + m_bStartup[0]=false; + return true; + } +@@ -1606,9 +1606,11 @@ bool CEvohome::DecodeBatteryInfo(CEvohomeMsg &msg) + RFX_SETID3(msg.GetID(0),tsen.EVOHOME2.id1,tsen.EVOHOME2.id2,tsen.EVOHOME2.id3) + tsen.EVOHOME2.updatetype = updBattery; + +- double dbCharge=0; +- if(nBattery!=0xFF) +- dbCharge=(double)nBattery/2.0; //Presumed to be the charge level where sent ++ if (nBattery == 0xFF) ++ nBattery = 100; // recode full battery (0xFF) to 100 for consistency across device types ++ else ++ nBattery = nBattery / 2; // recode battery level values to 0-100 from original 0-200 values ++ + if(nLowBat==0) + nBattery=0; + tsen.EVOHOME2.battery_level=nBattery; +@@ -1657,9 +1659,11 @@ bool CEvohome::DecodeBatteryInfo(CEvohomeMsg &msg) + tsen.EVOHOME2.type=pTypeEvohomeWater; + tsen.EVOHOME2.subtype=sTypeEvohomeWater; + tsen.EVOHOME2.zone=nDevNo; +- sDecodeRXMessage(this, (const unsigned char *)&tsen.EVOHOME2, NULL, nBattery); ++ RFX_SETID3(GetControllerID(), tsen.EVOHOME2.id1, tsen.EVOHOME2.id2, tsen.EVOHOME2.id3); ++ sDecodeRXMessage(this, (const unsigned char *)&tsen.EVOHOME2, "DHW Temp", nBattery); // Update DHW Zone sensor + } +- Log(true,LOG_STATUS,"evohome: %s: %s=%d charge=%d (%.1f %%) level=%d (%s)",tag,szType.c_str(),nDevNo,nBattery,dbCharge,nLowBat,(nLowBat==0)?"Low":"OK"); ++ ++ Log(true,LOG_STATUS,"evohome: %s: %s=%d charge=%d(%%) level=%d (%s)",tag,szType.c_str(),nDevNo,nBattery,nLowBat,(nLowBat==0)?"Low":"OK"); + + return true; + } diff --git a/utils/domoticz/patches/900_fix-build.patch b/utils/domoticz/patches/900_fix-build.patch new file mode 100644 index 0000000000..58e3bbb6bf --- /dev/null +++ b/utils/domoticz/patches/900_fix-build.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -606,8 +606,6 @@ else() + target_link_libraries(domoticz -lrt ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} pthread ${LUA_LIBRARIES} ${MQTT_LIBRARIES} ${SQLite_LIBRARIES} ${CMAKE_DL_LIBS} ${TELLDUS_LIBRARIES} ${EXECINFO_LIBRARIES}) + ENDIF() + +-ADD_PRECOMPILED_HEADER(domoticz "main/stdafx.h") +- + IF(CMAKE_COMPILER_IS_GNUCXX) + option(USE_STATIC_LIBSTDCXX "Build with static libgcc/libstdc++ libraries" YES) + IF(USE_STATIC_LIBSTDCXX) diff --git a/utils/domoticz/patches/901_no-udev.patch b/utils/domoticz/patches/901_no-udev.patch new file mode 100644 index 0000000000..7ac6b78f17 --- /dev/null +++ b/utils/domoticz/patches/901_no-udev.patch @@ -0,0 +1,42 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -534,39 +534,6 @@ IF(OpenZWave) + target_link_libraries(domoticz ${OpenZWave}) + include_directories(${CMAKE_SOURCE_DIR}/hardware/openzwave) + add_definitions(-DWITH_OPENZWAVE) +- # open-zwave needs libudev +- IF(CMAKE_SYSTEM_NAME STREQUAL "Darwin") +- set(IOKIT_LIBRARY "-framework IOKit -framework CoreFoundation" CACHE FILEPATH "IOKit framework" FORCE) +- target_link_libraries(domoticz ${IOKIT_LIBRARY}) +- else() +- IF(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") +- MESSAGE(STATUS "Building on FreeBSD, libudev not needed!") +- FIND_PATH(ICONV_INCLUDE_DIR iconv.h) +- FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c) +- IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) +- SET(ICONV_FOUND TRUE) +- #target_link_libraries(domoticz ${ICONV_INCLUDE_DIR}) +- target_link_libraries(domoticz ${ICONV_LIBRARIES} -lrt) +- message(STATUS ${ICONV_LIBRARIES}) +- else() +- MESSAGE(FATAL_ERROR "libiconv not found on your system") +- ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) +- else() +- find_library(UDEV NAMES libudev.a) +- IF(UDEV) +- message(STATUS ${UDEV}) +- target_link_libraries(domoticz ${UDEV} -lrt) +- else() +- find_library(UDEV NAMES libudev.so) +- IF(UDEV) +- message(STATUS ${UDEV}) +- target_link_libraries(domoticz ${UDEV} -lrt) +- else() +- MESSAGE(FATAL_ERROR "LIB UDEV not found on your system, see install.txt how to get them installed.\nsudo apt-get install libudev-dev") +- ENDIF(UDEV) +- ENDIF(UDEV) +- ENDIF() +- ENDIF() + else() + MESSAGE(STATUS "==== OpenZWave not found, support disabled!") + ENDIF(OpenZWave) diff --git a/utils/domoticz/patches/902_add-scripts-path.patch b/utils/domoticz/patches/902_add-scripts-path.patch new file mode 100644 index 0000000000..919cfeeea6 --- /dev/null +++ b/utils/domoticz/patches/902_add-scripts-path.patch @@ -0,0 +1,262 @@ +--- a/hardware/OpenZWave.cpp ++++ b/hardware/OpenZWave.cpp +@@ -993,7 +993,7 @@ bool COpenZWave::OpenSerialConnector() + } + m_nodes.clear(); + m_bNeedSave = false; +- std::string ConfigPath = szStartupFolder + "Config/"; ++ std::string ConfigPath = "/usr/share/domoticz/openzwave/"; + std::string UserPath = ConfigPath; + if (szStartupFolder != szUserDataFolder) + { +--- a/main/EventSystem.cpp ++++ b/main/EventSystem.cpp +@@ -44,7 +44,7 @@ extern "C" { + using namespace boost::python; + #endif + +-extern std::string szUserDataFolder; ++extern std::string szScriptsFolder; + + CEventSystem::CEventSystem(void) + { +@@ -1086,9 +1086,9 @@ void CEventSystem::EvaluateEvent(const s + std::stringstream lua_DirT; + + #ifdef WIN32 +- lua_DirT << szUserDataFolder << "scripts\\lua\\"; ++ lua_DirT << szScriptsFolder << "lua\\"; + #else +- lua_DirT << szUserDataFolder << "scripts/lua/"; ++ lua_DirT << szScriptsFolder << "lua/"; + #endif + + std::string lua_Dir = lua_DirT.str(); +@@ -1139,9 +1139,9 @@ void CEventSystem::EvaluateEvent(const s + { + std::stringstream python_DirT; + #ifdef WIN32 +- python_DirT << szUserDataFolder << "scripts\\python\\"; ++ python_DirT << szScriptsFolder << "python\\"; + #else +- python_DirT << szUserDataFolder << "scripts/python/"; ++ python_DirT << szScriptsFolder << "python/"; + #endif + + std::string python_Dir = python_DirT.str(); +@@ -2021,7 +2021,7 @@ bool CEventSystem::parseBlocklyActions(c + } + #if !defined WIN32 + if (sPath.find("/") != 0) +- sPath = szUserDataFolder + "scripts/" + sPath; ++ sPath = szScriptsFolder + sPath; + #endif + + m_sql.AddTaskItem(_tTaskItem::ExecuteScript(1, sPath, sParam)); +@@ -2133,9 +2133,9 @@ void CEventSystem::EvaluatePython(const + std::stringstream python_DirT; + + #ifdef WIN32 +- python_DirT << szUserDataFolder << "scripts\\python\\"; ++ python_DirT << szScriptsFolder << "python\\"; + #else +- python_DirT << szUserDataFolder << "scripts/python/"; ++ python_DirT << szScriptsFolder << "python/"; + #endif + std::string python_Dir = python_DirT.str(); + if(!Py_IsInitialized()) { +@@ -3909,9 +3909,9 @@ namespace http { + + std::stringstream template_file; + #ifdef WIN32 +- template_file << szUserDataFolder << "scripts\\templates\\" << eventType << "." << interpreter; ++ template_file << szScriptsFolder << "templates\\" << eventType << "." << interpreter; + #else +- template_file << szUserDataFolder << "scripts/templates/" << eventType << "." << interpreter; ++ template_file << szScriptsFolder << "templates/" << eventType << "." << interpreter; + #endif + std::ifstream file; + std::stringstream template_content; +--- a/main/LuaHandler.cpp ++++ b/main/LuaHandler.cpp +@@ -22,7 +22,7 @@ extern "C" { + #include "mainworker.h" + #include "../hardware/hardwaretypes.h" + +-extern std::string szUserDataFolder; ++extern std::string szScriptsFolder; + + int CLuaHandler::l_domoticz_applyXPath(lua_State* lua_state) + { +@@ -319,9 +319,9 @@ bool CLuaHandler::executeLuaScript(const + { + std::stringstream lua_DirT; + #ifdef WIN32 +- lua_DirT << szUserDataFolder << "scripts\\lua_parsers\\"; ++ lua_DirT << szScriptsFolder << "lua_parsers\\"; + #else +- lua_DirT << szUserDataFolder << "scripts/lua_parsers/"; ++ lua_DirT << szScriptsFolder << "lua_parsers/"; + #endif + std::string lua_Dir = lua_DirT.str(); + +--- a/main/SQLHelper.cpp ++++ b/main/SQLHelper.cpp +@@ -612,6 +612,7 @@ const char *sqlCreateMobileDevices = + "[LastUpdate] DATETIME DEFAULT(datetime('now', 'localtime'))" + ");"; + ++extern std::string szScriptsFolder; + extern std::string szUserDataFolder; + + CSQLHelper::CSQLHelper(void) +@@ -3408,9 +3409,9 @@ unsigned long long CSQLHelper::UpdateVal + //Execute possible script + std::string scriptname; + #ifdef WIN32 +- scriptname = szUserDataFolder + "scripts\\domoticz_main.bat"; ++ scriptname = szScriptsFolder + "domoticz_main.bat"; + #else +- scriptname = szUserDataFolder + "scripts/domoticz_main"; ++ scriptname = szScriptsFolder + "domoticz_main"; + #endif + if (file_exist(scriptname.c_str())) + { +@@ -6460,7 +6461,7 @@ bool CSQLHelper::HandleOnOffAction(const + std::string scriptname = OnAction.substr(9); + #if !defined WIN32 + if (scriptname.find("/") != 0) +- scriptname = szUserDataFolder + "scripts/" + scriptname; ++ scriptname = szScriptsFolder + scriptname; + #endif + std::string scriptparams=""; + //Add parameters +@@ -6492,7 +6493,7 @@ bool CSQLHelper::HandleOnOffAction(const + std::string scriptname = OffAction.substr(9); + #if !defined WIN32 + if (scriptname.find("/") != 0) +- scriptname = szUserDataFolder + "scripts/" + scriptname; ++ scriptname = szScriptsFolder + scriptname; + #endif + std::string scriptparams=""; + int pindex=scriptname.find(' '); +--- a/main/WebServer.cpp ++++ b/main/WebServer.cpp +@@ -55,6 +55,7 @@ + + #define round(a) ( int ) ( a + .5 ) + ++extern std::string szScriptsFolder; + extern std::string szUserDataFolder; + extern std::string szWWWFolder; + +@@ -2614,9 +2615,9 @@ namespace http { + if (scriptname.find("..") != std::string::npos) + return; + #ifdef WIN32 +- scriptname = szUserDataFolder + "scripts\\" + scriptname; ++ scriptname = szScriptsFolder + scriptname; + #else +- scriptname = szUserDataFolder + "scripts/" + scriptname; ++ scriptname = szScriptsFolder + scriptname; + #endif + if (!file_exist(scriptname.c_str())) + return; +--- a/main/domoticz.cpp ++++ b/main/domoticz.cpp +@@ -135,6 +135,7 @@ static const _facilities facilities[] = + }; + std::string logfacname = "user"; + #endif ++std::string szScriptsFolder; + std::string szStartupFolder; + std::string szUserDataFolder; + std::string szWWWFolder; +@@ -603,6 +604,19 @@ int main(int argc, char**argv) + szUserDataFolder = szroot; + } + ++ szScriptsFolder=szStartupFolder; ++ if (cmdLine.HasSwitch("-scripts")) ++ { ++ if (cmdLine.GetArgumentCount("-scripts") != 1) ++ { ++ _log.Log(LOG_ERROR, "Please specify a path for scripts directory"); ++ return 1; ++ } ++ std::string szroot = cmdLine.GetSafeArgument("-scripts", 0, ""); ++ if (szroot.size() != 0) ++ szScriptsFolder = szroot; ++ } ++ + if (cmdLine.HasSwitch("-startupdelay")) + { + if (cmdLine.GetArgumentCount("-startupdelay") != 1) +--- a/main/mainworker.cpp ++++ b/main/mainworker.cpp +@@ -139,6 +139,7 @@ + + #define round(a) ( int ) ( a + .5 ) + ++extern std::string szScriptsFolder; + extern std::string szStartupFolder; + extern std::string szUserDataFolder; + extern std::string szWWWFolder; +@@ -1394,8 +1395,8 @@ void MainWorker::Do_Work() + m_sql.GetPreferencesVar("ReleaseChannel", nValue); + bool bIsBetaChannel = (nValue != 0); + +- std::string scriptname = szUserDataFolder + "scripts/download_update.sh"; +- std::string strparm = szUserDataFolder; ++ std::string scriptname = szScriptsFolder + "download_update.sh"; ++ std::string strparm = szScriptsFolder; + if (bIsBetaChannel) + strparm += " /beta"; + +--- a/notifications/NotificationHTTP.cpp ++++ b/notifications/NotificationHTTP.cpp +@@ -6,7 +6,7 @@ + #include "../main/SQLHelper.h" + #include "../main/Logger.h" + +-extern std::string szUserDataFolder; ++extern std::string szScriptsFolder; + + CNotificationHTTP::CNotificationHTTP() : CNotificationBase(std::string("http"), OPTIONS_NONE) + { +@@ -97,7 +97,7 @@ bool CNotificationHTTP::SendMessageImple + std::string scriptparams = ""; + #if !defined WIN32 + if (scriptname.find("/") != 0) +- scriptname = szUserDataFolder + "scripts/" + scriptname; ++ scriptname = szScriptsFolder + scriptname; + #endif + //Add parameters + uPos = scriptname.find(" "); +--- a/push/GooglePubSubPush.cpp ++++ b/push/GooglePubSubPush.cpp +@@ -20,7 +20,7 @@ extern "C" { + using namespace boost::python; + #endif + +-extern std::string szUserDataFolder; ++extern std::string szScriptsFolder; + + // this should be filled in by the preprocessor + extern const char * Python_exe; +@@ -222,11 +222,11 @@ void CGooglePubSubPush::DoGooglePubSubPu + + #ifdef ENABLE_PYTHON + #ifdef WIN32 +- python_DirT << szUserDataFolder << "scripts\\python\\"; +- std::string filename = szUserDataFolder + "scripts\\python\\" + "googlepubsub.py"; ++ python_DirT << szScriptsFolder << "python\\"; ++ std::string filename = szScriptsFolder + "python\\" + "googlepubsub.py"; + #else +- python_DirT << szUserDataFolder << "scripts/python/"; +- std::string filename = szUserDataFolder + "scripts/python/" + "googlepubsub.py"; ++ python_DirT << szScriptsFolder << "python/"; ++ std::string filename = szScriptsFolder + "python/" + "googlepubsub.py"; + #endif + + char * argv[1]; diff --git a/utils/domoticz/patches/903_disable-libusb.patch b/utils/domoticz/patches/903_disable-libusb.patch new file mode 100644 index 0000000000..4e788f859d --- /dev/null +++ b/utils/domoticz/patches/903_disable-libusb.patch @@ -0,0 +1,39 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -476,20 +476,23 @@ else() + MESSAGE(FATAL_ERROR "cURL not found on your system, see install.txt how to get them installed. (for example 'sudo apt-get install curl libcurl4-openssl-dev')") + ENDIF(CURL_FOUND) + +-find_path(LIBUSB_INCLUDE_DIR usb.h +- HINTS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS}) +-find_library(LIBUSB_LIBRARY NAMES usb +- HINTS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS}) +-set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY}) ++option(WITH_LIBUSB "Enable libusb support" NO) ++ if(WITH_LIBUSB) ++ find_path(LIBUSB_INCLUDE_DIR usb.h ++ HINTS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS}) ++ find_library(LIBUSB_LIBRARY NAMES usb ++ HINTS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS}) ++ set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY}) + +-find_package_handle_standard_args(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR) +-IF(LIBUSB_FOUND) +- MESSAGE(STATUS "LIBUSB found at: ${LIBUSB_LIBRARIES}") +- add_definitions(-DWITH_LIBUSB) +- target_link_libraries(domoticz ${LIBUSB_LIBRARIES}) +-else() +- MESSAGE(STATUS "==== LibUSB not found, support for TE923/Voltcraft disabled!") +-ENDIF(LIBUSB_FOUND) ++ find_package_handle_standard_args(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR) ++ IF(LIBUSB_FOUND) ++ MESSAGE(STATUS "LIBUSB found at: ${LIBUSB_LIBRARIES}") ++ add_definitions(-DWITH_LIBUSB) ++ target_link_libraries(domoticz ${LIBUSB_LIBRARIES}) ++ else() ++ MESSAGE(STATUS "==== LibUSB not found, support for TE923/Voltcraft disabled!") ++ ENDIF(LIBUSB_FOUND) ++endif(WITH_LIBUSB) + + # + # Find MD5/RMD160/SHA library