From 5f14c0207717d842a57e0aa29a6234a4822e2f3f Mon Sep 17 00:00:00 2001 From: thecem <46648579+thecem@users.noreply.github.com> Date: Sun, 2 Nov 2025 12:17:18 +0100 Subject: [PATCH] HA Addon: fix config file check in entrypoint (#24972) --- packaging/docker/bin/entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/docker/bin/entrypoint.sh b/packaging/docker/bin/entrypoint.sh index bac8aa1a9..0aa110f84 100755 --- a/packaging/docker/bin/entrypoint.sh +++ b/packaging/docker/bin/entrypoint.sh @@ -5,12 +5,12 @@ set -e HASSIO_OPTIONSFILE=/data/options.json if [ -f ${HASSIO_OPTIONSFILE} ]; then - CONFIG=$(grep -o '"config_file": "[^"]*' ${HASSIO_OPTIONSFILE} | grep -o '[^"]*$') - SQLITE_FILE=$(grep -o '"sqlite_file": "[^"]*' ${HASSIO_OPTIONSFILE} | grep -o '[^"]*$') + CONFIG=$(grep -o '"config_file": "[^"]*' ${HASSIO_OPTIONSFILE} | grep -o '[^"]*$' || true) + SQLITE_FILE=$(grep -o '"sqlite_file": "[^"]*' ${HASSIO_OPTIONSFILE} | grep -o '[^"]*$' || true) # Config File Migration # If there is no config file found in '/config' we copy it from '/homeassistant' and rename the old config file to .migrated - if [ ! -f "${CONFIG}" ]; then + if [ -n "${CONFIG}" ] && [ ! -f "${CONFIG}" ]; then CONFIG_OLD=$(echo "${CONFIG}" | sed 's#^/config#/homeassistant#') if [ -f "${CONFIG_OLD}" ]; then mkdir -p "$(dirname "${CONFIG}")" && cp "${CONFIG_OLD}" "${CONFIG}"