Browse Source

Fix hacs installation

Joachim M. Giæver 2 years ago
parent
commit
0d98c7c49e

+ 0 - 12
snap/hooks/connect-plug-components

@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-
-CC=$SNAP_DATA/custom_components
-
-cp -rf "${SNAP}/hacs" "${CC}"
-if [ $? -ne 0 ]; then
-    logger "Failed to copy data"
-else
-    logger "Copied ${SNAP_NAME} data to Home Assistant:"
-    logger "From:     $SNAP/hacs -"
-    logger "To:       $CC/hacs"
-fi

+ 0 - 8
snap/hooks/disconnect-plug-components

@@ -1,8 +0,0 @@
-#!/bin/sh -e
-
-CC="${SNAP_DATA}/custom_components/hacs"
-logger "Removing ${SNAP_NAME} - ${CC}"
-rm -rf "${CC}"
-if [ $? -eq 0 ]; then
-    logger "Removed $SNAP_DATA/custom_components/hacs"
-fi

+ 0 - 5
snap/hooks/post-refresh

@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-
-# if snapctl is-connected components; then
-#     source "${SNAP}/snap/hooks/connect-plug-custom_components"
-# fi

+ 25 - 17
snap/snapcraft.yaml

@@ -52,10 +52,11 @@ architectures:
   - build-on: ppc64el
 
 apps:
-  list:
-    command: bin/app
-    plugs: 
+  install:
+    command: bin/install
+    plugs:
       - components
+      - network
 
 plugs:
   components:
@@ -65,28 +66,35 @@ plugs:
     default-provider: home-assistant-snap
 
 hooks:
-  post-refresh:
-    plugs: [components]
   connect-plug-components:
-    plugs: [components]
+    plugs: 
+      - components
+      - network
   disconnect-plug-components:
     plugs: [components]
 
+layout:
+  /etc/wgetrc:
+    bind-file: $SNAP/etc/wgetrc
+
+
 parts:
-  connection:
+  local:
     plugin: dump
     source: ./source
     source-type: local
     organize:
-      app: bin/app
+      install: bin/install
       hooks: snap/hooks
-    stage-packages:
-      - rsync
   hacs:
-    plugin: dump
-    source: https://github.com/hacs/integration.git
-    source-tag: ${SNAPCRAFT_PROJECT_VERSION}
-    organize:
-      custom_components/hacs: hacs
-    stage:
-      - hacs
+    plugin: nil
+    override-pull: |
+      wget https://get.hacs.xyz -O hacs
+    override-build: |
+      mv ${SNAPCRAFT_PART_BUILD}/hacs ${SNAPCRAFT_PART_INSTALL}/hacs
+      chmod +x ${SNAPCRAFT_PART_INSTALL}/hacs
+    build-packages:
+      - wget
+    stage-packages:
+      - wget
+      - unzip

+ 0 - 7
source/app

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