test
This commit is contained in:
+1
-11
@@ -1,5 +1,5 @@
|
|||||||
name: VirtualHere Client
|
name: VirtualHere Client
|
||||||
version: "0.1.272"
|
version: "0.1.274"
|
||||||
slug: vhclient
|
slug: vhclient
|
||||||
description: VirtualHere Client
|
description: VirtualHere Client
|
||||||
arch:
|
arch:
|
||||||
@@ -16,21 +16,11 @@ hassio_api: true
|
|||||||
#hassio_role: manager
|
#hassio_role: manager
|
||||||
homeassistant_api: true
|
homeassistant_api: true
|
||||||
#supervisor_api: true
|
#supervisor_api: true
|
||||||
#ports:
|
|
||||||
# 8000/tcp: 8000
|
|
||||||
ingress: true
|
ingress: true
|
||||||
#ingress_port: 8000
|
|
||||||
panel_icon: mdi:usb
|
panel_icon: mdi:usb
|
||||||
panel_title: vhclient
|
panel_title: vhclient
|
||||||
#devices:
|
|
||||||
# - /dev/mem
|
|
||||||
privileged:
|
privileged:
|
||||||
# - NET_ADMIN
|
|
||||||
- SYS_ADMIN
|
- SYS_ADMIN
|
||||||
# - SYS_RAWIO
|
|
||||||
# - SYS_TIME
|
|
||||||
# - SYS_NICE
|
|
||||||
#full_access: true
|
|
||||||
apparmor: false
|
apparmor: false
|
||||||
map:
|
map:
|
||||||
- type: addon_config
|
- type: addon_config
|
||||||
|
|||||||
-3
@@ -1,7 +1,5 @@
|
|||||||
#!/command/with-contenv bashio
|
#!/command/with-contenv bashio
|
||||||
|
|
||||||
sleep 5s
|
|
||||||
|
|
||||||
if bashio::config.has_value 'autofind'; then
|
if bashio::config.has_value 'autofind'; then
|
||||||
autofind=($(bashio::config 'autofind'))
|
autofind=($(bashio::config 'autofind'))
|
||||||
bashio::log.info "Set AUTOFIND hub to ${autofind}"
|
bashio::log.info "Set AUTOFIND hub to ${autofind}"
|
||||||
@@ -33,7 +31,6 @@ if bashio::config.has_value 'autouse'; then
|
|||||||
else
|
else
|
||||||
bashio::log.info "AUTO USE CLEAR ALL"
|
bashio::log.info "AUTO USE CLEAR ALL"
|
||||||
/usr/bin/vhclient -t "AUTO USE CLEAR ALL"
|
/usr/bin/vhclient -t "AUTO USE CLEAR ALL"
|
||||||
#sleep 5s
|
|
||||||
bashio::log.info "STOP USING ALL LOCAL"
|
bashio::log.info "STOP USING ALL LOCAL"
|
||||||
/usr/bin/vhclient -t "STOP USING ALL LOCAL"
|
/usr/bin/vhclient -t "STOP USING ALL LOCAL"
|
||||||
fi
|
fi
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
|
||||||
|
mapfile -t devices < <(/usr/bin/vh_list_devices)
|
||||||
|
for device in "${devices[@]}"; do
|
||||||
|
options=$(bashio::api.supervisor GET "/addons/self/options/config")
|
||||||
|
if [ -z $(echo $options | jq --arg device "$device" '.usbdevices[] | select(.device == ($device))') ]; then
|
||||||
|
bashio::log.info "Adding to config: ${device}"
|
||||||
|
options_updated=$(echo $options | jq --arg device "$device" '.usbdevices |= . + [{ device: ($device), use: false }]')
|
||||||
|
bashio::log.info "Options updated: ${options_updated}"
|
||||||
|
options_payload=$(echo $options_updated | jq -r '. = { options: . }')
|
||||||
|
bashio::log.info "Payload: ${options_payload}"
|
||||||
|
bashio::api.supervisor POST "/addons/self/options" $(echo $options_updated | jq -r '. = { options: . }')
|
||||||
|
fi
|
||||||
|
done
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
|
||||||
|
bashio::log.info "Waiting a bit for vhclient ..."
|
||||||
|
sleep 5s
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/etc/s6-overlay/s6-rc.d/config/run
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
#!/command/with-contenv bashio
|
|
||||||
#set -x
|
|
||||||
|
|
||||||
#test=($(bashio::config 'test'))
|
|
||||||
#test+=('one', 'two')
|
|
||||||
#bashio::config::update 'test' "${test[@]}"
|
|
||||||
#bashio::addon.option 'test' $test[@]
|
|
||||||
|
|
||||||
#TEST
|
|
||||||
#bashio::addon.option 'usbdevices' { 'name': 'one', 'use': false}
|
|
||||||
#my_array=($(bashio::config 'my_array'))
|
|
||||||
#my_array+=('one') # Add a new item to the array
|
|
||||||
#my_array+=({ 'name': 'one', 'use': false}) # Add a new item to the array
|
|
||||||
#bashio::config::update 'my_array' "${my_array[@]}"
|
|
||||||
|
|
||||||
#list1=$(/usr/bin/vhclient -t LIST)
|
|
||||||
#list2=$(eval 'grep "--" <<< "$list1"')
|
|
||||||
#bashio::log.info "${list1}"
|
|
||||||
#bashio::log.info "${list2}"
|
|
||||||
|
|
||||||
#mapfile -t devices < <(/usr/bin/vhclient -t LIST)
|
|
||||||
mapfile -t devices < <(/usr/bin/vh_list_devices)
|
|
||||||
for device in "${devices[@]}"; do
|
|
||||||
#options=$(bashio::addon.options)
|
|
||||||
options=$(bashio::api.supervisor GET "/addons/self/options/config")
|
|
||||||
gurka=$(echo $options | jq --arg device "$device" '.usbdevices[] | select(.device == ($device))')
|
|
||||||
bashio::log.info "Options: ${gurka}"
|
|
||||||
|
|
||||||
#if [[ ! " ${options}.usbdevices[*] " =~ [[:space:]]${device}[[:space:]] ]]; then
|
|
||||||
if [ -z $(echo $options | jq --arg device "$device" '.usbdevices[] | select(.device == ($device))') ]; then
|
|
||||||
|
|
||||||
bashio::log.info "Adding to config: ${device}"
|
|
||||||
|
|
||||||
options_updated=$(echo $options | jq --arg device "$device" '.usbdevices |= . + [{ device: ($device), use: false }]')
|
|
||||||
bashio::log.info "Options updated: ${options_updated}"
|
|
||||||
#payload=$(bashio::var.json options "^${new_options}")
|
|
||||||
#options_payload='{"options": ${options_updated}}'
|
|
||||||
options_payload=$(echo $options_updated | jq -r '. = { options: . }')
|
|
||||||
bashio::log.info "Payload: ${options_payload}"
|
|
||||||
bashio::api.supervisor POST "/addons/self/options" "${options_payload}"
|
|
||||||
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#options=$(bashio::addon.options)
|
|
||||||
#new_options=$(echo $options | jq .usbdevices += [{ device: 'ONE', use: false }])
|
|
||||||
#payload=$(bashio::var.json options "^${new_options}")
|
|
||||||
#bashio::api.supervisor POST "/addons/self/options" "${payload}"
|
|
||||||
curl -sH "Authorization: Bearer $SUPERVISOR_TOKEN" http://supervisor/addons/self/info | jq .data.options
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/with-contenv bashio
|
||||||
|
bashio::log.info "Adding selected devices"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
||||||
Reference in New Issue
Block a user