#!/usr/bin/env bash set -e export DAEMONIZED=1 source $SNAP/helper/functions SERVER_SSL=$(snapctl get server.ssl) SERVER_PORT=$(snapctl get server.port) COOKIE_SECURE=$(snapctl get sessio.cookie-secure) if [ $(echo "${SERVER_PORT}" | grep -E "^\-?[0-9]+$") = "" ]; then lprint "!! server.port must be numeric, got ${SERVER_PORT}" >&2 exit 1 fi if [ ${SERVER_SSL} != true -a ${SERVER_SSL} != false ]; then lprint "!! server.ssl must be boolean value" >&2 exit 1 fi if [ ${COOKIE_SECURE} != true -a ${COOKIE_SECURE} != false ]; then lprint "!! session.cookie-secure must be boolean value" >&2 exit 1 fi # AS WITH S0+n NETWORK_KEY is not used anymore # NETWORK_KEY=$(snapctl get network.key) # # if [ ! -f "${SNAP_DATA}/settings.json" ]; then # echo "{}" > ${SNAP_DATA}/settings.json # fi # # jq --arg networkKey "${NETWORK_KEY}" '.zwave.networkKey = $networkKey' $SNAP_DATA/settings.json > $SNAP_DATA/tmp.json # cat ${SNAP_DATA}/tmp.json > ${SNAP_DATA}/settings.json # rm ${SNAP_DATA}/tmp.json test_default_config RUNNING=$(snapctl services | grep "${SNAP_NAME}" | grep inactive | wc -l) if [ ${RUNNING} -eq 0 ]; then lprint "Restarting ${SNAP_NAME}" snapctl restart "${SNAP_NAME}" fi