Skip to content

Commit

Permalink
Fix config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre-io committed Oct 30, 2023
1 parent 6758d5f commit 9a4a323
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions vcontrold/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

11 changes: 7 additions & 4 deletions vcontrold/rootfs/etc/services.d/vcontrold/run
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion vcontrold/rootfs/etc/vcontrold/vcontrold.xml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,6 @@
</protocol>
</protocols>
<extern xmlns:xi="http://www.w3.org/2003/XInclude">
<xi:include href="vito.xml" parse="xml"/>
<xi:include href="#VITOXML#" parse="xml"/>
</extern>
</V-Control>

0 comments on commit 9a4a323

Please sign in to comment.