snapcraft.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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-configuration:
  49. interface: content
  50. content: ozw-configuration
  51. read:
  52. - $SNAP/usr/usr/local/etc/openzwave
  53. qt-ozw-db:
  54. interface: content
  55. content: ozw-db
  56. read:
  57. - $SNAP/usr/share/qt5
  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. build-packages:
  114. - build-essential
  115. - qt5-default
  116. - libqt5websockets5-dev
  117. - libqt5remoteobjects5-dev
  118. - libqt5remoteobjects5-bin
  119. - gcc-8-base
  120. - libgcc-8-dev
  121. - cmake
  122. - pkgconf
  123. - libunwind-dev
  124. - libcurl4-openssl-dev
  125. - rapidjson-dev
  126. stage-packages:
  127. - libdouble-conversion3
  128. - libicu66
  129. - libpcre2-16-0
  130. - libqt5core5a
  131. - libqt5network5
  132. - libqt5remoteobjects5
  133. - libqt5websockets5
  134. - libunwind8
  135. override-build: |
  136. if [ -f "Makefile" ]; then
  137. echo "Clean $SNAPCRAFT_PART_BUILD"
  138. qmake -r
  139. make distclean
  140. fi
  141. INSTALL_PATH="${HOME}"
  142. if [ ! -z ${container+x} ]; then
  143. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  144. fi
  145. OZW_INSTALL_PATH="${INSTALL_PATH}/parts/open-zwave/install"
  146. OZW_LIB_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name libopenzwave.so -print0 -quit))"
  147. OZW_INCLUDE_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name Manager.h -print0 -quit))"
  148. OZW_DATABASE_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name manufacturer_specific.xml))"
  149. qmake -r "CONFIG+=release" \
  150. OZW_LIB_PATH="${OZW_LIB_PATH}" \
  151. OZW_INCLUDE_PATH="${OZW_INCLUDE_PATH}" \
  152. OZW_DATABASE_PATH="${OZW_DATABASE_PATH}"
  153. make -j$(nproc)
  154. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  155. local-src:
  156. after: [qt-openzwave]
  157. plugin: dump
  158. source: ./src
  159. source-type: local
  160. stage-packages:
  161. - coreutils
  162. - netcat-openbsd
  163. organize:
  164. hooks: snap/hooks
  165. set-version:
  166. after: [qt-openzwave]
  167. plugin: nil
  168. override-build: |
  169. set -ex
  170. INSTALL_PATH="${HOME}"
  171. if [ ! -z ${container+x} ]; then
  172. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  173. fi
  174. LIBQT_OZW=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwave.so.1 -print -quit)")
  175. LIB_OZW=$(dirname "$(find ${INSTALL_PATH} -name libopenzwave.so* -print -quit)")
  176. LIB_OZWDB=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwavedatabase.so.1 -print -quit)")
  177. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBQT_OZW:$LIB_OZW:$LIB_OZWDB
  178. OZWD=$(find ${INSTALL_PATH} -type f -name ozwdaemon -print -quit)
  179. snapcraftctl set-version "$($OZWD --version | cut -f2 -d ' ')"