post-refresh 478 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. source "${SNAP}/init"
  3. logger "Running post-refresh ${SNAP_NAME} (uuid: ${UUID})"
  4. logger "Running config test"
  5. set -e
  6. CC="${SNAP_DATA}/custom_components"
  7. CCT="${SNAP_DATA}/.custom_components"
  8. if [ -d "${CC}" ]; then
  9. logger "Disabling custom components"
  10. mv "${CC}" "${CCT}"
  11. fi
  12. $SNAP/bin/hass --script check_config --config "${SNAP_DATA}"
  13. RES=$?
  14. if [ -d "${CC}" ]; then
  15. logger "Enabling custom components"
  16. mv "${CCT}" "${CC}"
  17. fi
  18. exit $RES