瀏覽代碼

Add hooks and cmd

Joachim M. Giæver 4 年之前
父節點
當前提交
37ff66e30f
共有 5 個文件被更改,包括 36 次插入4 次删除
  1. 1 0
      snap/hooks/install
  2. 6 0
      snap/hooks/post-refresh
  3. 4 0
      snap/hooks/remove
  4. 18 4
      snap/snapcraft.yaml
  5. 7 0
      source/app

+ 1 - 0
snap/hooks/install

@@ -0,0 +1 @@
+#!/usr/bin/env bash

+ 6 - 0
snap/hooks/post-refresh

@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+cp -rf "$SNAP/hacs" "$SNAP_DATA/custom_components/hacs"
+echo "Copyied data to Home Assistant:"
+echo "From:     $SNAP/hacs -"
+echo "To:       $SNAP_DATA/custom_components/hacs"

+ 4 - 0
snap/hooks/remove

@@ -0,0 +1,4 @@
+#!/bin/sh -e
+
+rm -rf $SNAP_DATA/custom_components/hacs
+echo "Removed: $SNAP_DATA/custom_components/hacs"

+ 18 - 4
snap/snapcraft.yaml

@@ -19,20 +19,34 @@ description: |
 grade: devel
 confinement: strict
 
+apps:
+  connected:
+    command: bin/app
+    plugs: 
+      - components
+
 plugs:
-  lib-hacs:
+  components:
     interface: content
-    content: lib-hacs
+    content: components
     target: $SNAP_DATA/custom_components
     default-provider: home-assistant-snap
 
 hooks:
+  install:
+    plugs: [components]
   post-refresh:
-    plugs: [lib-hacs]
+    plugs: [components]
   remove:
-    plugs: [lib-hacs]
+    plugs: [components]
 
 parts:
+  connection:
+    plugin: dump
+    source: ./source
+    source-type: local
+    organize:
+      app: bin/app
   hacs:
     plugin: dump
     source: https://github.com/hacs/integration.git

+ 7 - 0
source/app

@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+snapctl is-connected components
+
+echo "Connected: $?"
+
+ls -al $SNAP_DATA/custom_components