snapcraft.yaml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. qt-ozw-lib:
  49. interface: content
  50. content: qt-ozw-lib
  51. read:
  52. - $SNAP/usr/lib
  53. - $SNAP/usr/local
  54. parts:
  55. open-zwave:
  56. plugin: make
  57. source: https://github.com/OpenZWave/open-zwave.git
  58. qtmqtt:
  59. after: [open-zwave]
  60. plugin: make # aka qmake
  61. source: https://github.com/qt/qtmqtt.git
  62. source-tag: 5.12.8
  63. build-packages:
  64. - build-essential
  65. - qt5-default
  66. - qtbase5-private-dev
  67. override-build: |
  68. if [ -f "Makefile" ]; then
  69. echo "Clean $SNAPCRAFT_PART_BUILD"
  70. qmake -r
  71. make distclean
  72. fi
  73. qmake
  74. make -j$(nproc)
  75. make -j$(nproc) install
  76. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  77. override-prime: |
  78. snapcraftctl prime
  79. stage-packages:
  80. - libdouble-conversion3
  81. - libfreetype6
  82. - libgl1
  83. - libglvnd0
  84. - libglx0
  85. - libgraphite2-3
  86. - libharfbuzz0b
  87. - libicu66
  88. - libpcre2-16-0
  89. - libpng16-16
  90. - libqt5core5a
  91. - libqt5gui5
  92. - libqt5network5
  93. - libqt5websockets5
  94. - libqt5widgets5
  95. - libx11-6
  96. - libxau6
  97. - libxcb1
  98. - libxdmcp6
  99. qt-openzwave:
  100. after: [open-zwave, qtmqtt]
  101. plugin: make # aka qmake?
  102. source: https://github.com/OpenZWave/qt-openzwave.git
  103. build-packages:
  104. - build-essential
  105. - qt5-default
  106. - libqt5websockets5-dev
  107. - libqt5remoteobjects5-dev
  108. - libqt5remoteobjects5-bin
  109. - gcc-8-base
  110. - libgcc-8-dev
  111. - cmake
  112. - pkgconf
  113. - libunwind-dev
  114. - libcurl4-openssl-dev
  115. - rapidjson-dev
  116. stage-packages:
  117. - libdouble-conversion3
  118. - libicu66
  119. - libpcre2-16-0
  120. - libqt5core5a
  121. - libqt5network5
  122. - libqt5remoteobjects5
  123. - libqt5websockets5
  124. - libunwind8
  125. override-build: |
  126. if [ -f "Makefile" ]; then
  127. echo "Clean $SNAPCRAFT_PART_BUILD"
  128. qmake -r
  129. make distclean
  130. fi
  131. INSTALL_PATH="${HOME}"
  132. if [ ! -z ${container+x} ]; then
  133. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  134. fi
  135. OZW_INSTALL_PATH="${INSTALL_PATH}/parts/open-zwave/install"
  136. OZW_LIB_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name libopenzwave.so -print0 -quit))"
  137. OZW_INCLUDE_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name Manager.h -print0 -quit))"
  138. OZW_DATABASE_PATH="$(dirname $(find ${OZW_INSTALL_PATH} -name manufacturer_specific.xml))"
  139. qmake -r "CONFIG+=release" \
  140. OZW_LIB_PATH="${OZW_LIB_PATH}" \
  141. OZW_INCLUDE_PATH="${OZW_INCLUDE_PATH}" \
  142. OZW_DATABASE_PATH="${OZW_DATABASE_PATH}"
  143. make -j$(nproc)
  144. make -j$(nproc) install INSTALL_ROOT="${SNAPCRAFT_PART_INSTALL}"
  145. local-src:
  146. after: [qt-openzwave]
  147. plugin: dump
  148. source: ./src
  149. source-type: local
  150. stage-packages:
  151. - coreutils
  152. - netcat-openbsd
  153. organize:
  154. hooks: snap/hooks
  155. set-version:
  156. after: [qt-openzwave]
  157. plugin: nil
  158. override-build: |
  159. set -ex
  160. INSTALL_PATH="${HOME}"
  161. if [ ! -z ${container+x} ]; then
  162. INSTALL_PATH="/build/${SNAPCRAFT_PROJECT_NAME}"
  163. fi
  164. LIBQT_OZW=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwave.so.1 -print -quit)")
  165. LIB_OZW=$(dirname "$(find ${INSTALL_PATH} -name libopenzwave.so* -print -quit)")
  166. LIB_OZWDB=$(dirname "$(find ${INSTALL_PATH} -name libqt-openzwavedatabase.so.1 -print -quit)")
  167. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIBQT_OZW:$LIB_OZW:$LIB_OZWDB
  168. OZWD=$(find ${INSTALL_PATH} -type f -name ozwdaemon -print -quit)
  169. snapcraftctl set-version "$($OZWD --version | cut -f2 -d ' ')"