Migrate add-on data out of Home Assitant config dir

This commit is contained in:
Felipe Santos 2025-03-16 13:14:43 -03:00
parent 6c6694588e
commit 1a11daee15
2 changed files with 11 additions and 1 deletions

View file

@ -22,10 +22,11 @@ ports_description:
map:
- addons
- backup
- config:rw
- addon_config:rw
- share
- ssl
- media
- homeassistant_config:rw # to enable migration to addon_config
hassio_api: true
auth_api: true
docker_api: true

View file

@ -6,6 +6,15 @@
declare protocol
bashio::require.unprotected
# Migrate add-on data from the Home Assistant config directory,
# to the add-on configuration directory.
if ! bashio::fs.file_exists '/config/glances.conf' \
&& bashio::fs.file_exists '/homeassistant/glances/glances.conf'; then
shopt -s dotglob
mv /homeassistant/glances/* /config/ \
|| bashio::exit.nok "Failed to migrate Glances configuration out of Home Assistant config directory"
fi
# Ensure the configuration exists
if bashio::fs.file_exists '/config/glances/glances.conf'; then
cp -f /config/glances/glances.conf /etc/glances.conf