瀏覽代碼

Add hooks

Joachim M. Giæver 3 年之前
父節點
當前提交
61c04dcd88
共有 3 個文件被更改,包括 23 次插入1 次删除
  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