Browse Source

Add hooks and cmd

Joachim M. Giæver 3 years ago
parent
commit
37ff66e30f
5 changed files with 36 additions and 4 deletions
  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