|
@@ -51,35 +51,6 @@ function same_network_key {
|
|
|
return 0
|
|
|
}
|
|
|
|
|
|
-function cpy_2_zui {
|
|
|
- if snapctl is-connected zui-store; then
|
|
|
- if [ "$(ls "${SNAP_COMMON}/zui-store" | wc -l)" -ne 0 ]; then
|
|
|
- lprint "The zui-store (${SNAP_COMMON}/zui-store) is not empty, exiting..." >&2
|
|
|
- exit 1
|
|
|
- elif [ -d "${SNAP_COMMON}/zui-store" ]; then
|
|
|
- cp -rf "${SNAP_DATA}/"* "${SNAP_COMMON}/zui-store"
|
|
|
- if [ $? -ne 0 ]; then
|
|
|
- lprint "Failed copying data from ${SNAP_COMMON}/zui-store" >&2
|
|
|
- return 1
|
|
|
- fi
|
|
|
- mkdir -p "${SNAP_COMMON}/zui-store/logs/zwave-js"
|
|
|
- mv "${SNAP_COMMON}/zui-store/zwave"*.{log,json} "${SNAP_COMMON}/zui-store/logs/zwave-js"
|
|
|
- mv "${SNAP_COMMON}/zui-store/logs" "${SNAP_COMMON}/zui-store/.old-z2m-logs"
|
|
|
- rm -rf "${SNAP_COMMON}/zui-store/.ext-config"
|
|
|
- touch "${SNAP_DATA}/.z2m-cpy"
|
|
|
- else
|
|
|
- lprint "Missing directory ${SNAP_COMMON}/zui-store, cannot write to it. Exiting..." >&2
|
|
|
- exit 1
|
|
|
- fi
|
|
|
- else
|
|
|
- lprint "Can not copy config: Missing connection «store-dir» (offered by <zwave-js-ui>: 'snap install zwave-js-ui')." >&2
|
|
|
- lprint "Please install and connect with:" 1>&2
|
|
|
- lprint "$ snap connect ${SNAP_NAME}:zui-store zwave-js-ui:store-dir" >&2
|
|
|
- return 1
|
|
|
- fi
|
|
|
- return 0
|
|
|
-}
|
|
|
-
|
|
|
function plug_connected {
|
|
|
if ! snapctl is-connected "${1}"; then
|
|
|
lprint "Missing plug: «${1}»" >&2
|