test
This commit is contained in:
@@ -4,32 +4,23 @@ 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')
|
||||
|
||||
#if bashio::config.has_value 'autofind'; then
|
||||
#autofind=($(bashio::config 'autofind'))
|
||||
bashio::log.info "Set AUTOFIND hub to ${autofind}"
|
||||
#if [ "${autofind}" = "true" ]; then
|
||||
if $autofind; then
|
||||
bashio::log.info "Enable AutoFind"
|
||||
/usr/bin/vh_edit_config General AutoFind 1
|
||||
else
|
||||
bashio::log.info "Disable AutoFind"
|
||||
/usr/bin/vh_edit_config General AutoFind 0
|
||||
fi
|
||||
#fi
|
||||
if $autofind; then
|
||||
bashio::log.info "Enable AutoFind"
|
||||
/usr/bin/vh_edit_config General AutoFind 1
|
||||
else
|
||||
bashio::log.info "Disable AutoFind"
|
||||
/usr/bin/vh_edit_config General AutoFind 0
|
||||
fi
|
||||
|
||||
#if bashio::config.has_value 'autouse'; then
|
||||
#autouse=($(bashio::config 'autouse'))
|
||||
#if [ "${autouse}" = "true" ]; then
|
||||
if $autouse; then
|
||||
bashio::log.info "AUTO USE ALL"
|
||||
/usr/bin/vhclient -t "AUTO USE ALL"
|
||||
else
|
||||
bashio::log.info "AUTO USE CLEAR ALL"
|
||||
/usr/bin/vhclient -t "AUTO USE CLEAR ALL"
|
||||
bashio::log.info "STOP USING ALL LOCAL"
|
||||
/usr/bin/vhclient -t "STOP USING ALL LOCAL"
|
||||
fi
|
||||
#fi
|
||||
if $autouse; then
|
||||
bashio::log.info "AUTO USE ALL"
|
||||
/usr/bin/vhclient -t "AUTO USE ALL"
|
||||
else
|
||||
bashio::log.info "AUTO USE CLEAR ALL"
|
||||
/usr/bin/vhclient -t "AUTO USE CLEAR ALL"
|
||||
bashio::log.info "STOP USING ALL LOCAL"
|
||||
/usr/bin/vhclient -t "STOP USING ALL LOCAL"
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'clientid'; then
|
||||
clientid=($(bashio::config 'clientid'))
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/command/with-contenv bashio
|
||||
|
||||
/usr/bin/vhclient -t "GET CLIENT STATE"
|
||||
|
||||
bashio::log.info "Waiting a bit for vhclient ..."
|
||||
sleep 5s
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
#set -x
|
||||
|
||||
#bashio::log.info "Adding selected devices"
|
||||
|
||||
if bashio::config.has_value 'usbdevices'; then
|
||||
#usbdevices=($(bashio::config 'usbdevices'))
|
||||
#bashio::log.info "Devices: ${usbdevices}"
|
||||
options=$(bashio::api.supervisor GET "/addons/self/options/config")
|
||||
#bashio::log.info "Options: ${options}"
|
||||
usbdevices_json=$(echo $options | jq -c '.usbdevices[]')
|
||||
readarray -t usbdevices < <(echo "$usbdevices_json")
|
||||
#bashio::log.info "Devices: ${usbdevices[@]}"
|
||||
mapfile -t inuse_devices < <(/usr/bin/vh_list_inuse_devices)
|
||||
#bashio::log.info "Inuse devices: ${inuse_devices[@]}"
|
||||
for usbdevice in "${usbdevices[@]}"; do
|
||||
use=$(echo $usbdevice | jq '. | if .use then true else false end')
|
||||
device=$(echo $usbdevice | jq '.device | tostring')
|
||||
deviceid=$(echo $device | sed 's/.*(\(.*\)).*/\1/g')
|
||||
#bashio::log.info "Use: ${use} Device: ${device} Deviceid: ${deviceid}"
|
||||
if $use; then
|
||||
#bashio::log.info "AUTO USE DEVICE,${deviceid}"
|
||||
#/usr/bin/vhclient -t "AUTO USE DEVICE,${deviceid}"
|
||||
bashio::log.info "USE,${deviceid}"
|
||||
/usr/bin/vhclient -t "USE,${deviceid}"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user