Browse Source

Add hooks

Joachim M. Giæver 4 years ago
parent
commit
61c04dcd88
3 changed files with 23 additions and 1 deletions
  1. 6 0
      hooks/install.sh
  2. 4 0
      hooks/uninstall.sh
  3. 13 1
      snap/snapcraft.yaml

+ 6 - 0
hooks/install.sh

@@ -0,0 +1,6 @@
+#!/bin/sh -e
+
+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
hooks/uninstall.sh

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

+ 13 - 1
snap/snapcraft.yaml

@@ -17,7 +17,7 @@ description: |
     - Shortcuts to repositories/issue tracker
 
 grade: devel 
-confinement: devmode 
+confinement: strict
 
 plugs:
   lib-hacs:
@@ -27,6 +27,12 @@ plugs:
       - $SNAP_DATA/custom_components
     default-provider: home-assistant-snap
 
+hooks:
+  install:
+    plugs: [lib-hacs]
+  remove:
+    plugs: [lib-hacs]
+
 parts:
   hacs:
     plugin: dump
@@ -36,3 +42,9 @@ parts:
       custom_components/hacs: hacs
     stage:
       - hacs
+  configure-hooks:
+    plugin: dump
+    source: hooks
+    organize:
+      install.sh: snap/hooks/post-refresh
+      uninstall.sh: snap/hooks/remove