snapcraft.yaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. name: zwavejs2mqtt
  2. base: core20
  3. version: 'v7.1.0'
  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. exec:
  33. environment:
  34. STORE_DIR: $SNAP_DATA
  35. ZWAVEJS_EXTERNAL_CONFIG: $SNAP_DATA/.ext-config
  36. command: bin/yarn start
  37. command-chain:
  38. - helper/env-wrapper
  39. plugs:
  40. - network
  41. - network-bind
  42. - raw-usb
  43. - serial-port
  44. - hardware-observe
  45. help:
  46. command: helper/env-wrapper --help
  47. enable:
  48. command: bin/daemonize
  49. disable:
  50. command: bin/de-daemonize
  51. restart:
  52. command: bin/restart
  53. layout:
  54. /usr/local/share/.cache/yarn:
  55. bind: $SNAP/.cache/yarn
  56. /usr/local/share/.yarn:
  57. symlink: $SNAP/lib/node_modules
  58. parts:
  59. zwavejs2mqtt:
  60. after: [nodejs, dependencies]
  61. plugin: dump
  62. source: https://github.com/zwave-js/zwavejs2mqtt.git
  63. #source-branch: "master"
  64. #source-tag: "v7.1.0"
  65. source-tag: $SNAPCRAFT_PROJECT_VERSION
  66. build-packages:
  67. - gcc
  68. - build-essential
  69. build-environment:
  70. - LD_LIBRARY_PATH: "${LD_LIBRARY_PATH}:$(dirname $(find ${SNAPCRAFT_STAGE} -name libonig.so.2 -print0))"
  71. - PATH: "${PATH}:${SNAPCRAFT_PART_BUILD}/bin"
  72. override-build: |
  73. # Used when testing an unreleased version of Z-wavejs
  74. #sed -i 's/"zwave-js".*$/"zwave-js"\: "10.0.5-0-pr-4836-ed10b36"/g' ${SNAPCRAFT_PART_BUILD}/package.json
  75. # Link the bundled yarn
  76. cd "${SNAPCRAFT_PART_BUILD}/bin"
  77. YARN="$(find ${SNAPCRAFT_PART_BUILD} -name yarn-*.cjs -print0)"
  78. ln -s "../${YARN:${#SNAPCRAFT_PART_BUILD}+1}" ./yarn
  79. chmod +x ./yarn
  80. cd "${SNAPCRAFT_PART_BUILD}"
  81. # Necessary for the remote build; sometimes.
  82. if [ -n "${http_proxy-}" ]; then
  83. yarn config set httpProxy "${http_proxy}"
  84. fi
  85. if [ -n "${https_proxy-}" ]; then
  86. yarn config set httpsProxy "${https_proxy}"
  87. fi
  88. yarn install
  89. yarn build:server
  90. yarn build:ui
  91. yarn remove $(cat "${SNAPCRAFT_PART_BUILD}/package.json" | jq -r '.devDependencies | keys | join(" ")')
  92. # Copy built version into install directory
  93. mkdir -p "${SNAPCRAFT_PART_INSTALL}/lib/" \
  94. && cp --archive --link --no-dereference "${SNAPCRAFT_PART_BUILD}" \
  95. "${SNAPCRAFT_PART_INSTALL}/lib/zwavejs2mqtt"
  96. # Link yarn in install directory
  97. mkdir "${SNAPCRAFT_PART_INSTALL}/bin" \
  98. && cd "${SNAPCRAFT_PART_INSTALL}/bin" \
  99. && ln -s "../lib/zwavejs2mqtt/bin/yarn" "yarn"
  100. filesets:
  101. zwavejs2mqtt-include:
  102. - bin
  103. - lib/zwavejs2mqtt/.git
  104. - lib/zwavejs2mqtt/*.md
  105. - lib/zwavejs2mqtt/bin/yarn
  106. - lib/zwavejs2mqtt/dist
  107. - lib/zwavejs2mqtt/hass
  108. - lib/zwavejs2mqtt/node_modules
  109. - lib/zwavejs2mqtt/server
  110. - lib/zwavejs2mqtt/snippets
  111. - lib/zwavejs2mqtt/package.json
  112. - lib/zwavejs2mqtt/views
  113. - lib/zwavejs2mqtt/.yarn
  114. - lib/zwavejs2mqtt/yarn.lock
  115. - lib/zwavejs2mqtt/.yarnrc.yml
  116. - lib/zwavejs2mqtt/LICENSE
  117. stage:
  118. - $zwavejs2mqtt-include
  119. dependencies:
  120. plugin: nil
  121. stage-snaps:
  122. - jq
  123. - yq
  124. stage-packages:
  125. - git
  126. - udev
  127. - iproute2
  128. nodejs:
  129. plugin: dump
  130. source:
  131. - on amd64: https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.gz
  132. - on arm64: https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-arm64.tar.gz
  133. - on armhf: https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-armv7l.tar.gz
  134. stage-packages:
  135. - on armhf:
  136. - libatomic1
  137. organize:
  138. '*.md': nodejs/
  139. LICENSE: nodejs/
  140. prime:
  141. - -include
  142. - -share
  143. - -lib/node_modules
  144. - -bin/npm
  145. - -bin/npx
  146. - -bin/corepack
  147. override-stage: |
  148. corepack disable
  149. snapcraftctl stage
  150. local:
  151. plugin: dump
  152. source: src/
  153. stage-packages:
  154. - uuid
  155. organize:
  156. hooks: snap/hooks