Browse Source

Remove config sync as of new env.var + layout lockfile for db update

Joachim M. Giæver 2 years ago
parent
commit
e253f554e9
5 changed files with 24 additions and 19 deletions
  1. 7 6
      snap/snapcraft.yaml
  2. 1 0
      src/helper/env-wrapper
  3. 7 6
      src/helper/functions
  4. 2 1
      src/hooks/install
  5. 7 6
      src/hooks/post-refresh

+ 7 - 6
snap/snapcraft.yaml

@@ -22,7 +22,6 @@ architectures:
   - build-on: amd64
   - build-on: arm64
   - build-on: armhf
-    #- build-on: ppc64el
 
 apps:
   zwavejs2mqtt:
@@ -65,14 +64,15 @@ apps:
     command: bin/restart
 
 layout:
-  $SNAP/lib/node_modules/zwavejs2mqtt/node_modules/@zwave-js/config:
-    bind: $SNAP/lib/node_modules/zwavejs2mqtt/node_modules/@zwave-js/config
   /usr/local/share/.cache/yarn:
     bind: $SNAP/.cache/yarn
   /usr/local/share/.yarn:
     symlink: $SNAP/lib/node_modules
   $SNAP/lib/node_modules/zwavejs2mqtt/package.json.lock:
-    bind-file: $SNAP/lib/node_modules/zwavejs2mqtt/package.json.lock:
+    bind-file: $SNAP/lib/node_modules/zwavejs2mqtt/package.json.lock
+  # Not needed anymore as of ZWAVEJS_EXTERNAL_CONFIG ?
+  # $SNAP/lib/node_modules/zwavejs2mqtt/node_modules/@zwave-js/config:
+  #   bind: $SNAP/lib/node_modules/zwavejs2mqtt/node_modules/@zwave-js/config
 
 parts:
   zwavejs2mqtt:
@@ -96,7 +96,8 @@ parts:
         && cp --archive --link --no-dereference $SNAPCRAFT_PART_BUILD \
           $SNAPCRAFT_PART_INSTALL/lib/node_modules/zwavejs2mqtt \
     organize:
-      lib/node_modules/zwavejs2mqtt/node_modules/@zwave-js/config: snap/zwave-js/config
+      # Not needed anymore as of ZWAVEJS_EXTERNAL_CONFIG?
+      # lib/node_modules/zwavejs2mqtt/node_modules/@zwave-js/config: snap/zwave-js/config
       lib/node_modules/zwavejs2mqtt/dist: lib/node_modules/zwavejs2mqtt/server/dist
       lib/node_modules/zwavejs2mqtt/views: lib/node_modules/zwavejs2mqtt/server/views
     filesets:
@@ -109,7 +110,7 @@ parts:
         - lib/node_modules/zwavejs2mqtt/package.json
         - lib/node_modules/zwavejs2mqtt/yarn.lock
     stage:
-      - snap
+      # - snap
       - $zwavejs2mqtt-include
   dependencies:
     plugin: nil

+ 1 - 0
src/helper/env-wrapper

@@ -75,6 +75,7 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
+# Not needed anymore as of ZWAVEJS_EXTERNAL_CONFIG?
 # ensure_zwavejs_config
 
 export SERVER_SSL=$(snapctl get server.ssl)

+ 7 - 6
src/helper/functions

@@ -3,12 +3,13 @@
 export ZWAVE_JS_CONF="${SNAP}/lib/node_modules/zwavejs2mqtt/node_modules/@zwave-js/config"
 
 function ensure_zwavejs_config {
-    if [ "$(find ${ZWAVE_JS_CONF} -maxdepth 0 -empty -exec echo empty \;)" == "empty" ]; then
-        logger "Config directory is empty, copying data from ${SNAP}/snap/zwave-js/config"
-        rsync -raz "${SNAP}/snap/zwave-js/config" "${ZWAVE_JS_CONF}/.."
-    else
-        logger "Config directory ${ZWAVE_JS_CONF} exists"
-    fi
+    # Not needed anymore as of ZWAVEJS_EXTERNAL_CONFIG
+    # if [ "$(find ${ZWAVE_JS_CONF} -maxdepth 0 -empty -exec echo empty \;)" == "empty" ]; then
+    #     logger "Config directory is empty, copying data from ${SNAP}/snap/zwave-js/config"
+    #     rsync -raz "${SNAP}/snap/zwave-js/config" "${ZWAVE_JS_CONF}/.."
+    # else
+    #     logger "Config directory ${ZWAVE_JS_CONF} exists"
+    # fi
     return 0
 }
 

+ 2 - 1
src/hooks/install

@@ -10,7 +10,8 @@ if [ $? -eq 0 ]; then
     SETTINGS_KEY=$(cat /dev/urandom | LC_ALL=C tr -dc '0-9A-F' | fold -w 32 | head -n 1)
 fi
 
-ensure_zwavejs_config
+# Not needed anymore as of ZWAVEJS_EXTERNAL_CONFIG ?
+# ensure_zwavejs_config
 
 testnset_config "network.key" "${SETTINGS_KEY}"
 test_default_config

+ 7 - 6
src/hooks/post-refresh

@@ -2,11 +2,12 @@
 
 source $SNAP/helper/functions
 
-if [ -d "${SNAP_COMMON}/latest-device-config/config" ]; then
-    logger "Restoring latest device config latest-device-config to ${ZWAVE_JS_CONF}"
-    rsync -raz "${SNAP_COMMON}/latest-device-config/config" "${ZWAVE_JS_CONF}/.."
-else
-    ensure_zwavejs_config
-fi
+# Not needed anymore as of ZWAVEJS_EXTERNAL_CONFIG?
+# if [ -d "${SNAP_COMMON}/latest-device-config/config" ]; then
+#     logger "Restoring latest device config latest-device-config to ${ZWAVE_JS_CONF}"
+#     rsync -raz "${SNAP_COMMON}/latest-device-config/config" "${ZWAVE_JS_CONF}/.."
+# else
+#     ensure_zwavejs_config
+# fi
 
 test_default_config