Files
home-assistant-addons/vhclient/rootfs/etc/s6-overlay/scripts/init-config
Hans Karlinius a1e03be7c5 test
2024-12-01 09:13:23 +01:00

43 lines
1.3 KiB
Plaintext
Executable File

#!/command/with-contenv bashio
options=$(bashio::api.supervisor GET "/addons/self/options/config")
autofind=$(echo $options | jq '. | if .autofind then true else false end')
autouse=$(echo $options | jq '. | if .autouse then true else false end')
clientid=$(echo $options | jq '.clientid | tostring')
manualhub=$(echo $options | jq '.manualhub | tostring')
if $autofind; then
bashio::log.info "Enable General AutoFind"
/usr/bin/vh_edit_config General AutoFind 1
else
bashio::log.info "Disable General AutoFind"
/usr/bin/vh_edit_config General AutoFind 0
fi
if $autouse; then
bashio::log.info "Enable AutoShare All"
/usr/bin/vh_edit_config AutoShare All 1
else
bashio::log.info "Disable AutoShare"
/usr/bin/vh_edit_config AutoShare All 0
fi
#if bashio::config.has_value 'clientid'; then
if [ -n "$clientid" ]; then
#clientid=($(bashio::config 'clientid'))
bashio::log.info "Set General ClientId to ${clientid}"
/usr/bin/vh_edit_config General ClientId ${clientid}
else
bashio::log.info "Set General ClientId to null"
/usr/bin/vh_edit_config General ClientId null
fi
if [ -n "$manualhub" ]; then
bashio::log.info "Set Settings ManualHubs to ${manualhub}"
/usr/bin/vh_edit_config Settings ManualHubs ${manualhub}
else
bashio::log.info "Set Settings ManualHubs to null"
/usr/bin/vh_edit_config Settings ManualHubs null
fi