From 9a4a323a78f36457d0c3552c776d03ee3aae7502 Mon Sep 17 00:00:00 2001 From: Alexandre-io Date: Mon, 30 Oct 2023 12:56:06 +0100 Subject: [PATCH] Fix config file --- vcontrold/DOCS.md | 4 ++-- vcontrold/rootfs/etc/services.d/vcontrold/run | 11 +++++++---- vcontrold/rootfs/etc/vcontrold/vcontrold.xml | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/vcontrold/DOCS.md b/vcontrold/DOCS.md index 86a3ec6..2bd0989 100644 --- a/vcontrold/DOCS.md +++ b/vcontrold/DOCS.md @@ -112,10 +112,10 @@ mqtt: ``` ### Custom vito.xml configuration file -The module utilizes the `addon_config`` option (refer to https://developers.home-assistant.io/docs/add-ons/configuration/#add-on-advanced-options) for mounting a custom configuration file. It verifies the existence of a 'vito.xml' file during startup. +The module use the `config` option (refer to https://developers.home-assistant.io/docs/add-ons/configuration/#add-on-advanced-options) for mounting a custom configuration file. It verifies the existence of a 'vito.xml' file during startup. Ensure the file is placed in the specified path: ``` -/addon_configs/vcontrold/vito.xml +config/vcontrold/vito.xml ``` diff --git a/vcontrold/rootfs/etc/services.d/vcontrold/run b/vcontrold/rootfs/etc/services.d/vcontrold/run index 1f2c7a2..a428c06 100755 --- a/vcontrold/rootfs/etc/services.d/vcontrold/run +++ b/vcontrold/rootfs/etc/services.d/vcontrold/run @@ -15,14 +15,14 @@ declare config_commands ## Get the 'message' key from the user config options. config_tty=$(bashio::config 'tty') -config_file=/etc/vcontrold/vito.xml +config_file=vito.xml config_deviceid=$(bashio::config 'device_id') config_commands=$(bashio::config 'commands') ## Check if custom vito.xml file exist -if [ -f "/config/vito.xml" ]; then +if [ -f "/config/vcontrold/vito.xml" ]; then bashio::log.info "Using a custom vito.xml file" - config_file=/config/vito.xml + config_file=/config/vcontrold/vito.xml fi # Cleanup scripts @@ -56,6 +56,9 @@ done # Set device ID sed -i "s/#DEVICEID#/$config_deviceid/g" /etc/vcontrold/vcontrold.xml +# Set vito.xml +sed -i "s/#VITOXML#/$config_file/g" /etc/vcontrold/vcontrold.xml + if bashio::config.true 'debug'; then sed -i "s/#DEBUG#/y/g" /etc/vcontrold/vcontrold.xml else @@ -65,7 +68,7 @@ fi ## Run your program if [ "$VCONTROL_HOST" = "localhost" ] ; then bashio::log.info "Starting local vcontrold..." - exec /usr/sbin/vcontrold -n -U root -d $config_tty -x $config_file + exec /usr/sbin/vcontrold -n -U root -d $config_tty else # do nothing - needed as a dummy job to keep the dependency job running tail -f /dev/null diff --git a/vcontrold/rootfs/etc/vcontrold/vcontrold.xml b/vcontrold/rootfs/etc/vcontrold/vcontrold.xml index 8618335..daef2fd 100644 --- a/vcontrold/rootfs/etc/vcontrold/vcontrold.xml +++ b/vcontrold/rootfs/etc/vcontrold/vcontrold.xml @@ -440,6 +440,6 @@ - +