containers/apps/home-assistant/entrypoint.sh

29 lines
719 B
Bash

#!/usr/bin/env bash
# shellcheck disable=SC2086
# Ensure /config/tmp exists and set correct permissions
if [[ ! -d /config/tmp ]]; then
mkdir -p /config/tmp
chmod 1777 /config/tmp
fi
# Ensure /config/.cache/uv exists
if [[ ! -d /config/.cache/uv ]]; then
mkdir -p /config/.cache/uv
chmod -R 775 /config/.cache/uv
fi
# Export necessary environment variables
export TMPDIR="/config/tmp"
export UV_CACHE_DIR="/config/.cache/uv"
# Ensure HACS installation if requested
if [[ "${HOME_ASSISTANT__HACS_INSTALL}" == "true" ]]; then
curl -sfSL https://get.hacs.xyz | bash -
fi
# Execute Home Assistant with the provided arguments
exec \
/usr/local/bin/hass \
--config /config \
"$@"