Przeglądaj źródła

Add missing hooks file

Joachim M. Giæver 1 rok temu
rodzic
commit
181125c7f4
2 zmienionych plików z 18 dodań i 3 usunięć
  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