diff --git a/vhclient/Dockerfile b/vhclient/Dockerfile index 2a4c4cc..aa4de78 100644 --- a/vhclient/Dockerfile +++ b/vhclient/Dockerfile @@ -2,11 +2,11 @@ ARG BUILD_FROM FROM $BUILD_FROM # Install requirements for add-on -RUN \ - apk add --no-cache \ - nginx +#RUN \ +# apk add --no-cache \ +# nginx -WORKDIR /data +#WORKDIR /data # Copy root filesystem COPY rootfs / diff --git a/vhclient/config.yaml b/vhclient/config.yaml index 1951857..d993ca5 100644 --- a/vhclient/config.yaml +++ b/vhclient/config.yaml @@ -1,5 +1,5 @@ name: VirtualHere Client -version: "0.1.314" +version: "0.1.315" slug: vhclient description: VirtualHere Client arch: diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/config-client/run b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/config-client/run index 430d73f..6c93592 100755 --- a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/config-client/run +++ b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/config-client/run @@ -1,14 +1,8 @@ #!/command/with-contenv bashio -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/vh_edit_config General AutoFind 1 - else - /usr/bin/vh_edit_config General AutoFind 0 - fi -fi +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 'clientid'; then clientid=($(bashio::config 'clientid')) @@ -22,9 +16,21 @@ if bashio::config.has_value 'manualhub'; then /usr/bin/vhclient -t "MANUAL HUB ADD,${manualhub}" fi -if bashio::config.has_value 'autouse'; then - autouse=($(bashio::config 'autouse')) - if [ "${autouse}" = "true" ]; then +#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 + /usr/bin/vh_edit_config General AutoFind 1 + else + /usr/bin/vh_edit_config General AutoFind 0 + fi +#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 @@ -33,4 +39,4 @@ if bashio::config.has_value 'autouse'; then bashio::log.info "STOP USING ALL LOCAL" /usr/bin/vhclient -t "STOP USING ALL LOCAL" fi -fi +#fi diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/dependencies.d/vhclient b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/dependencies.d/vhclient deleted file mode 100644 index e69de29..0000000 diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/run b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/run deleted file mode 100755 index 8a12c9e..0000000 --- a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/with-contenv bashio -bashio::log.info "Starting VirtualHere HTTP" -exec nginx -c /etc/nginx/vhclient.conf diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/type b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/type deleted file mode 100644 index 1780f9f..0000000 --- a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/type +++ /dev/null @@ -1 +0,0 @@ -longrun \ No newline at end of file diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/up b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/up deleted file mode 100644 index 633d6f0..0000000 --- a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/http/up +++ /dev/null @@ -1 +0,0 @@ -/etc/s6-overlay/s6-rc.d/http/run \ No newline at end of file diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/run b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/run index 22ff9d9..1ea5c78 100755 --- a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/run +++ b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/run @@ -8,24 +8,26 @@ 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}" + #bashio::log.info "Options: ${options}" usbdevices_json=$(echo $options | jq -c '.usbdevices[]') readarray -t usbdevices < <(echo "$usbdevices_json") - bashio::log.info "Devices: ${usbdevices[@]}" + #bashio::log.info "Devices: ${usbdevices[@]}" mapfile -t inuse_devices < <(/usr/bin/vh_list_inuse_devices) - bashio::log.info "Inuse devices: ${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 "AUTO USE DEVICE,${deviceid}" + #/usr/bin/vhclient -t "AUTO USE DEVICE,${deviceid}" + bashio::log.info "USE,${deviceid}" + /usr/bin/vhclient -t "USE,${deviceid}" else if [[ "${inuse_devices[@]}" =~ "$device" ]]; then bashio::log.info "STOP USING,${deviceid}" - #/usr/bin/vhclient -t "STOP USING,${deviceid}" + /usr/bin/vhclient -t "STOP USING,${deviceid}" fi fi done