소스 검색

Add missing hooks file

Joachim M. Giæver 2 년 전
부모
커밋
181125c7f4
2개의 변경된 파일18개의 추가작업 그리고 3개의 파일을 삭제
  1. 6 3
      snap/snapcraft.yaml
  2. 12 0
      src/hooks/connect-plug-store-dir

+ 6 - 3
snap/snapcraft.yaml

@@ -83,6 +83,8 @@ apps:
     command: bin/de-daemonize
   restart:
     command: bin/restart
+  copy-2-zui:
+    command: bin/cpy-2-zui
 
 layout:
   /usr/local/share/.cache/yarn:
@@ -91,11 +93,12 @@ layout:
     symlink: $SNAP/lib/node_modules
 
 plugs:
-  store-dir:
+  zui-store:
     interface: content
-    content: store-dir 
+    content: zui-store 
     target: $SNAP_COMMON/zui-store
-    default-provider: zwave-js-ui
+    # Wait with the default provider
+    #default-provider: zwave-js-ui
 
 parts:
   zwavejs2mqtt:

+ 12 - 0
src/hooks/connect-plug-store-dir

@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+ZUI_STORE="${SNAP_COMMON}/zui-store"
+
+if [ ! -d "${ZUI_STORE}" ]; then
+	echo "Missing store-dir for ZUI. Failed, exiting...." >&2
+	exit 1
+fi
+
+if [ $(ls "${ZUI_STORE}" | wc -l) -eq 0 ]; then
+	cpy_2_zui && sudo snap stop "${SNAP_NAME}" && sudo snap disable "${SNAP_NAME}"
+fi