snapcraft.yaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. name: zwavejs2mqtt
  2. base: core20
  3. version: 'v7.1.0-SEL-CC'
  4. summary: Fully configurable Zwave to MQTT Gateway and Control Panel.
  5. description: "** Fully configurable Zwave to MQTT Gateway and Control Panel**\n\n- Zwave to Mqtt Gateway: Configure how nodes and nodes values are \n mapped between the two protocols\n- Secured: Supports HTTPS and users authentication\n- Control Panel UI: Directly control all your nodes and their \n values from the UI, some of control panel features:\n - Nodes management: check all nodes discovered in the z-wave \n network and manage their values\n - Firmware updates: update devices firmware, just select the \n controller action _Begin Firmware Update_ and upload the \n firmware file\n - Groups associations: add/edit nodes associations\n - Full zwave-js APIs support\n- Custom scenes management: create scenes and trigger them by using\n MQTT apis (also supports timeouts)\n- Log debug in UI: See debug logs directly from the UI\n- Store directory management: all files are stored in store folder, \n you can download/edit files inside this folder directly from the UI\n- Network graph: see how nodes are communicating with the controller,\n useful for diagnostics purposes\n- Home Assistant integration: you can use official Zwavejs integration \n by enabling zwavejs server or use integrated MQTT discovery integration\n\n**Channels in `latest`**\n\nThis is how we use the different of channels in the `latest` track, \nto give the user a chance to choose how often they want updates.\n\n- `latest/stable`: Latest version of the last *major* release. Will\n only update once per major release and most likely by the end of\n that release cycle. E.g when there is a new version `b.a.a` then\n version `a.b.c` will be will be available.\n\n- `latest/candidate`: Latest minor or patch release of latest major\n release. E.g when version `a.b.c` changes to `a.b.d` or `a.c.a`, then\n version `a.b.d` or `a.c.a` will be available. Consider this rolling\n releases.\n\n- `latest/edge` and `latest/edge/dev`: Every build (including tests) \\n might be pushed to these channels.\n"
  6. grade: stable
  7. confinement: strict
  8. license: MIT
  9. assumes:
  10. - command-chain
  11. architectures:
  12. - build-on: amd64
  13. - build-on: arm64
  14. - build-on: armhf
  15. apps:
  16. zwavejs2mqtt:
  17. daemon: simple
  18. restart-condition: always
  19. environment:
  20. STORE_DIR: $SNAP_DATA
  21. ZWAVEJS_EXTERNAL_CONFIG: $SNAP_DATA/.ext-config
  22. DAEMONIZED: 1
  23. command: bin/yarn start
  24. command-chain:
  25. - helper/env-wrapper
  26. plugs:
  27. - network
  28. - network-bind
  29. - raw-usb
  30. - serial-port
  31. - hardware-observe
  32. - log-observe
  33. exec:
  34. environment:
  35. STORE_DIR: $SNAP_DATA
  36. ZWAVEJS_EXTERNAL_CONFIG: $SNAP_DATA/.ext-config
  37. command: bin/yarn start
  38. command-chain:
  39. - helper/env-wrapper
  40. plugs:
  41. - network
  42. - network-bind
  43. - raw-usb
  44. - serial-port
  45. - hardware-observe
  46. help:
  47. command: helper/env-wrapper --help
  48. enable:
  49. command: bin/daemonize
  50. disable:
  51. command: bin/de-daemonize
  52. restart:
  53. command: bin/restart
  54. layout:
  55. /usr/local/share/.cache/yarn:
  56. bind: $SNAP/.cache/yarn
  57. /usr/local/share/.yarn:
  58. symlink: $SNAP/lib/node_modules
  59. parts:
  60. zwavejs2mqtt:
  61. after: [nodejs, dependencies]
  62. plugin: dump
  63. source: https://github.com/zwave-js/zwavejs2mqtt.git
  64. #source-branch: "master"
  65. source-tag: "v7.1.0"
  66. #source-tag: $SNAPCRAFT_PROJECT_VERSION
  67. build-packages:
  68. - gcc
  69. - build-essential
  70. build-environment:
  71. - LD_LIBRARY_PATH: "${LD_LIBRARY_PATH}:$(dirname $(find ${SNAPCRAFT_STAGE} -name libonig.so.2 -print0))"
  72. - PATH: "${PATH}:${SNAPCRAFT_PART_BUILD}/bin"
  73. override-build: |
  74. # Used when testing an unreleased version of Z-wavejs
  75. # sed -i 's/"zwave-js".*$/"zwave-js"\: "10.0.5-0-pr-4836-ed10b36"/g' ${SNAPCRAFT_PART_BUILD}/package.json
  76. # Link the bundled yarn
  77. cd "${SNAPCRAFT_PART_BUILD}/bin"
  78. YARN="$(find ${SNAPCRAFT_PART_BUILD} -name yarn-*.cjs -print0)"
  79. ln -s "../${YARN:${#SNAPCRAFT_PART_BUILD}+1}" ./yarn
  80. chmod +x ./yarn
  81. cd "${SNAPCRAFT_PART_BUILD}"
  82. # Necessary for the remote build; sometimes.
  83. if [ -n "${http_proxy-}" ]; then
  84. yarn config set httpProxy "${http_proxy}"
  85. fi
  86. if [ -n "${https_proxy-}" ]; then
  87. yarn config set httpsProxy "${https_proxy}"
  88. fi
  89. yarn install
  90. yarn build:server
  91. yarn build:ui
  92. yarn remove $(cat "${SNAPCRAFT_PART_BUILD}/package.json" | jq -r '.devDependencies | keys | join(" ")')
  93. # Copy built version into install directory
  94. mkdir -p "${SNAPCRAFT_PART_INSTALL}/lib/" \
  95. && cp --archive --link --no-dereference "${SNAPCRAFT_PART_BUILD}" \
  96. "${SNAPCRAFT_PART_INSTALL}/lib/zwavejs2mqtt"
  97. # Link yarn in install directory
  98. mkdir "${SNAPCRAFT_PART_INSTALL}/bin" \
  99. && cd "${SNAPCRAFT_PART_INSTALL}/bin" \
  100. && ln -s "../lib/zwavejs2mqtt/bin/yarn" "yarn"
  101. filesets:
  102. zwavejs2mqtt-include:
  103. - bin
  104. - lib/zwavejs2mqtt/.git
  105. - lib/zwavejs2mqtt/*.md
  106. - lib/zwavejs2mqtt/bin/yarn
  107. - lib/zwavejs2mqtt/dist
  108. - lib/zwavejs2mqtt/hass
  109. - lib/zwavejs2mqtt/node_modules
  110. - lib/zwavejs2mqtt/server
  111. - lib/zwavejs2mqtt/snippets
  112. - lib/zwavejs2mqtt/package.json
  113. - lib/zwavejs2mqtt/views
  114. - lib/zwavejs2mqtt/.yarn
  115. - lib/zwavejs2mqtt/yarn.lock
  116. - lib/zwavejs2mqtt/.yarnrc.yml
  117. - lib/zwavejs2mqtt/LICENSE
  118. stage:
  119. - $zwavejs2mqtt-include
  120. dependencies:
  121. plugin: nil
  122. stage-snaps:
  123. - jq
  124. - yq
  125. stage-packages:
  126. - git
  127. - udev
  128. - iproute2
  129. nodejs:
  130. plugin: dump
  131. source:
  132. - on amd64: https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.gz
  133. - on arm64: https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-arm64.tar.gz
  134. - on armhf: https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-armv7l.tar.gz
  135. stage-packages:
  136. - on armhf:
  137. - libatomic1
  138. organize:
  139. '*.md': nodejs/
  140. LICENSE: nodejs/
  141. prime:
  142. - -include
  143. - -share
  144. - -lib/node_modules
  145. - -bin/npm
  146. - -bin/npx
  147. - -bin/corepack
  148. override-stage: |
  149. corepack disable
  150. snapcraftctl stage
  151. local:
  152. plugin: dump
  153. source: src/
  154. stage-packages:
  155. - uuid
  156. organize:
  157. hooks: snap/hooks