snapcraft.yaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. name: ozwdaemon
  2. base: core20
  3. adopt-info: set-version
  4. summary: "QT Wrapper for OpenZWave. Remotely manage a Z-Wave Network."
  5. description: |
  6. A dedicated snap package that contains only the ozwdaemon service.
  7. This snap contains only the ozwdaemon application and none of the management tools. Use Home Assistant or OZW Admin to connect to it.
  8. NOTE! To add secure devices through Home Assistant, you have to make service calls, with the payload:
  9. ```
  10. {
  11. "secure": true,
  12. "instance_id": <id given in configuration>
  13. }
  14. ```
  15. This is an issue with the OpenZWave integration of Home Assistant and will hopefully be fixed in the future.
  16. See `snap get ozwdaemon -d` for configuration options.
  17. grade: stable
  18. confinement: strict
  19. apps:
  20. ozwdaemon:
  21. daemon: simple
  22. restart-condition: on-failure
  23. command: usr/local/bin/ozwdaemon
  24. command-chain:
  25. - bin/env-wrapper
  26. plugs:
  27. - network
  28. - network-bind
  29. - raw-usb
  30. enable:
  31. command: bin/daemonize
  32. disable:
  33. command: bin/de-daemonize
  34. restart:
  35. command: bin/restart
  36. exec:
  37. command: usr/local/bin/ozwdaemon --exec
  38. command-chain:
  39. - bin/env-wrapper
  40. plugs:
  41. - network
  42. - network-bind
  43. - raw-usb
  44. layout:
  45. /usr/local/share/OpenZWave/qt-openzwavedatabase.rcc:
  46. bind-file: $SNAP/usr/share/qt5/qt-openzwavedatabase.rcc
  47. slots:
  48. ozw-config:
  49. interface: content
  50. content: ozw-config
  51. read:
  52. - $SNAP/usr/local/etc/openzwave
  53. ozw-db:
  54. interface: content
  55. content: ozw-db
  56. read:
  57. - $SNAP/usr/share/qt5/qt-openzwavedatabase.rcc
  58. qt-ozw-lib:
  59. interface: content
  60. content: qt-ozw-lib
  61. read:
  62. - $SNAP/usr/lib
  63. - $SNAP/usr/local
  64. parts:
  65. open-zwave:
  66. plugin: make
  67. source: https://github.com/OpenZWave/open-zwave.git
  68. qtmqtt:
  69. after: [open-zwave]
  70. plugin: make # aka qmake
  71. source: https://github.com/qt/qtmqtt.git
  72. source-tag: 5.12.8
  73. build-packages:
  74. - build-essential
  75. - qt5-default
  76. - qtbase5-private-dev
  77. override-build: |
  78. if [ -f "Makefile" ]; then
  79. echo "Clean $SNAPCRAFT_PART_BUILD"
  80. qmake -r
  81. make distclean
  82. fi
  83. qmake
  84. make -j$(nproc)
  85. make -j$(nproc) install
  86. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  87. override-prime: |
  88. snapcraftctl prime
  89. stage-packages:
  90. - libdouble-conversion3
  91. - libfreetype6
  92. - libgl1
  93. - libglvnd0
  94. - libglx0
  95. - libgraphite2-3
  96. - libharfbuzz0b
  97. - libicu66
  98. - libpcre2-16-0
  99. - libpng16-16
  100. - libqt5core5a
  101. - libqt5gui5
  102. - libqt5network5
  103. - libqt5websockets5
  104. - libqt5widgets5
  105. - libx11-6
  106. - libxau6
  107. - libxcb1
  108. - libxdmcp6
  109. qt-openzwave:
  110. after: [open-zwave, qtmqtt]
  111. plugin: make # aka qmake?
  112. #source: https://github.com/OpenZWave/qt-openzwave.git
  113. source: https://github.com/home-assistant-snap/qt-openzwave.git
  114. build-packages:
  115. - build-essential
  116. - qt5-default
  117. - libqt5websockets5-dev
  118. - libqt5remoteobjects5-dev
  119. - libqt5remoteobjects5-bin
  120. - gcc-8-base
  121. - libgcc-8-dev
  122. - cmake
  123. - pkgconf
  124. - libunwind-dev
  125. - libcurl4-openssl-dev
  126. - rapidjson-dev
  127. stage-packages:
  128. - libdouble-conversion3
  129. - libicu66
  130. - libpcre2-16-0
  131. - libqt5core5a
  132. - libqt5network5
  133. - libqt5remoteobjects5
  134. - libqt5websockets5
  135. - libunwind8
  136. override-build: |
  137. if [ -f "Makefile" ]; then
  138. echo "Clean $SNAPCRAFT_PART_BUILD"
  139. qmake -r
  140. make distclean
  141. fi
  142. INSTALL_PATH="${HOME}"
  143. if [ ! -z ${container+x} ]; then
  144. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  145. fi
  146. OZW_INSTALL_PATH="${INSTALL_PATH}/parts/open-zwave/install"
  147. OZW_LIB_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name libopenzwave.so -print0 -quit))"
  148. OZW_INCLUDE_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name Manager.h -print0 -quit))"
  149. OZW_DATABASE_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name manufacturer_specific.xml))"
  150. qmake -r "CONFIG+=release" \
  151. OZW_LIB_PATH="${OZW_LIB_PATH}" \
  152. OZW_INCLUDE_PATH="${OZW_INCLUDE_PATH}" \
  153. OZW_DATABASE_PATH="${OZW_DATABASE_PATH}"
  154. make -j$(nproc)
  155. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  156. local-src:
  157. after: [qt-openzwave]
  158. plugin: dump
  159. source: ./src
  160. source-type: local
  161. stage-packages:
  162. - coreutils
  163. - netcat-openbsd
  164. organize:
  165. hooks: snap/hooks
  166. set-version:
  167. after: [qt-openzwave]
  168. plugin: nil
  169. override-build: |
  170. set -ex
  171. INSTALL_PATH="${HOME}"
  172. if [ ! -z ${container+x} ]; then
  173. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  174. fi
  175. LIBQT_OZW=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwave.so.1 -print -quit)")
  176. LIB_OZW=$(dirname "$(find ${INSTALL_PATH} -name libopenzwave.so* -print -quit)")
  177. LIB_OZWDB=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwavedatabase.so.1 -print -quit)")
  178. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBQT_OZW:$LIB_OZW:$LIB_OZWDB
  179. OZWD=$(find ${INSTALL_PATH} -type f -name ozwdaemon -print -quit)
  180. snapcraftctl set-version "$($OZWD --version | cut -f2 -d ' ')"