test
This commit is contained in:
@@ -3,17 +3,18 @@
|
||||
if bashio::config.has_value 'autofind'; then
|
||||
autofind=($(bashio::config 'autofind'))
|
||||
bashio::log.info "Set AUTOFIND hub to ${autofind}"
|
||||
if [ "${autofind}" = "true" ]; then
|
||||
/usr/bin/vhconfig_edit General AutoFind 1
|
||||
#if [ "${autofind}" = "true" ]; then
|
||||
if $autofind; then
|
||||
/usr/bin/vh_edit_config General AutoFind 1
|
||||
else
|
||||
/usr/bin/vhconfig_edit General AutoFind 0
|
||||
/usr/bin/vh_edit_config General AutoFind 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'clientid'; then
|
||||
clientid=($(bashio::config 'clientid'))
|
||||
bashio::log.info "Set ClientId to ${clientid}"
|
||||
/usr/bin/vhconfig_edit General ClientId ${clientid}
|
||||
/usr/bin/vh_edit_config General ClientId ${clientid}
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'manualhub'; then
|
||||
|
||||
@@ -5,13 +5,10 @@ mapfile -t devices < <(/usr/bin/vh_list_devices)
|
||||
for device in "${devices[@]}"; do
|
||||
options=$(bashio::api.supervisor GET "/addons/self/options/config")
|
||||
options_usbdevices_device=$(echo $options | jq --arg device "$device" '.usbdevices[] | select(.device == ($device))')
|
||||
bashio::log.info "Options exists: ${options_usbdevices_device}"
|
||||
if [ -z "$options_usbdevices_device" ]; then
|
||||
bashio::log.info "Adding to config: ${device}"
|
||||
options_updated=$(echo $options | jq --arg device "$device" '.usbdevices |= . + [{ device: ($device), use: false }]')
|
||||
bashio::log.debug "Options updated: ${options_updated}"
|
||||
options_payload=$(echo $options_updated | jq -r '. = { options: . }')
|
||||
bashio::log.debug "Payload: ${options_payload}"
|
||||
bashio::api.supervisor POST "/addons/self/options" "${options_payload}"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -12,6 +12,8 @@ if bashio::config.has_value 'usbdevices'; then
|
||||
usbdevices_json=$(echo $options | jq -c '.usbdevices[]')
|
||||
readarray -t usbdevices < <(echo "$usbdevices_json")
|
||||
bashio::log.info "Devices: ${usbdevices[@]}"
|
||||
mapfile -t devices < <(/usr/bin/vh_list_inuse_devices)
|
||||
|
||||
for usbdevice in "${usbdevices[@]}"; do
|
||||
use=$(echo $usbdevice | jq '. | if .use then true else false end')
|
||||
device=$(echo $usbdevice | jq '.device | tostring')
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/command/with-contenv bashio
|
||||
|
||||
/usr/bin/vhclient -t list|awk '{ if ($1 ~ /-->/) { print substr($0, 8, index($0, ")") - 7 ) } }'
|
||||
/usr/bin/vhclient -t list | awk '{ if ($1 ~ /-->/) { print substr($0, 8, index($0, ")") - 7 ) } }'
|
||||
|
||||
3
vhclient/rootfs/usr/bin/vh_list_inuse_devices
Executable file
3
vhclient/rootfs/usr/bin/vh_list_inuse_devices
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/command/with-contenv bashio
|
||||
|
||||
/usr/bin/vhclient -t list | awk '{ if ($1 ~ /\*-->/) { print substr($0, 8, index($0, ")") - 7 ) } }'
|
||||
Reference in New Issue
Block a user