From cb43bd7793889efc880a023541bf274c78a21676 Mon Sep 17 00:00:00 2001 From: Hans Karlinius Date: Sun, 1 Dec 2024 09:05:36 +0100 Subject: [PATCH] test --- vhclient/config.yaml | 2 +- ...lient-add-devices => vhclient-use-devices} | 0 .../dependencies.d/config-devices | 0 .../type | 0 .../up | 0 .../etc/s6-overlay/scripts/config-client | 32 +++++++++---------- .../rootfs/etc/s6-overlay/scripts/init-config | 31 +++++++++++++++--- ...lient-add-devices => vhclient-use-devices} | 0 vhclient/translations/en.yaml | 2 +- 9 files changed, 44 insertions(+), 23 deletions(-) rename vhclient/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/{vhclient-add-devices => vhclient-use-devices} (100%) rename vhclient/rootfs/etc/s6-overlay/s6-rc.d/{vhclient-add-devices => vhclient-use-devices}/dependencies.d/config-devices (100%) rename vhclient/rootfs/etc/s6-overlay/s6-rc.d/{vhclient-add-devices => vhclient-use-devices}/type (100%) rename vhclient/rootfs/etc/s6-overlay/s6-rc.d/{vhclient-add-devices => vhclient-use-devices}/up (100%) rename vhclient/rootfs/etc/s6-overlay/scripts/{vhclient-add-devices => vhclient-use-devices} (100%) diff --git a/vhclient/config.yaml b/vhclient/config.yaml index d1e19b3..b7ac578 100644 --- a/vhclient/config.yaml +++ b/vhclient/config.yaml @@ -30,7 +30,6 @@ usb: true usbip: true kernel_modules: true options: - updateconfig: true autouse: true autofind: true clientid: '' @@ -46,6 +45,7 @@ schema: device: str?, use: bool? }] + preventconfig: bool stage: experimental init: false diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/vhclient-add-devices b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/vhclient-use-devices similarity index 100% rename from vhclient/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/vhclient-add-devices rename to vhclient/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/vhclient-use-devices diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/dependencies.d/config-devices b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-use-devices/dependencies.d/config-devices similarity index 100% rename from vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/dependencies.d/config-devices rename to vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-use-devices/dependencies.d/config-devices diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/type b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-use-devices/type similarity index 100% rename from vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/type rename to vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-use-devices/type diff --git a/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/up b/vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-use-devices/up similarity index 100% rename from vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-add-devices/up rename to vhclient/rootfs/etc/s6-overlay/s6-rc.d/vhclient-use-devices/up diff --git a/vhclient/rootfs/etc/s6-overlay/scripts/config-client b/vhclient/rootfs/etc/s6-overlay/scripts/config-client index bab45f1..71d0af2 100755 --- a/vhclient/rootfs/etc/s6-overlay/scripts/config-client +++ b/vhclient/rootfs/etc/s6-overlay/scripts/config-client @@ -1,8 +1,8 @@ #!/command/with-contenv bashio -options=$(bashio::api.supervisor GET "/addons/self/options/config") +#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') +#autouse=$(echo $options | jq '. | if .autouse then true else false end') #if $autofind; then # bashio::log.info "Enable AutoFind" @@ -12,15 +12,15 @@ autouse=$(echo $options | jq '. | if .autouse then true else false end') # /usr/bin/vh_edit_config General AutoFind 0 #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 $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')) @@ -28,8 +28,8 @@ fi # /usr/bin/vh_edit_config General ClientId ${clientid} #fi -if bashio::config.has_value 'manualhub'; then - manualhub=($(bashio::config 'manualhub')) - bashio::log.info "MANUAL HUB ADD,${manualhub}" - /usr/bin/vhclient -t "MANUAL HUB ADD,${manualhub}" -fi +#if bashio::config.has_value 'manualhub'; then +# manualhub=($(bashio::config 'manualhub')) +# bashio::log.info "MANUAL HUB ADD,${manualhub}" +# /usr/bin/vhclient -t "MANUAL HUB ADD,${manualhub}" +#fi diff --git a/vhclient/rootfs/etc/s6-overlay/scripts/init-config b/vhclient/rootfs/etc/s6-overlay/scripts/init-config index 5e4a59d..d22cd65 100755 --- a/vhclient/rootfs/etc/s6-overlay/scripts/init-config +++ b/vhclient/rootfs/etc/s6-overlay/scripts/init-config @@ -2,17 +2,38 @@ 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 AutoFind" + bashio::log.info "Enable General AutoFind" /usr/bin/vh_edit_config General AutoFind 1 else - bashio::log.info "Disable AutoFind" + bashio::log.info "Disable General AutoFind" /usr/bin/vh_edit_config General AutoFind 0 fi -if bashio::config.has_value 'clientid'; then - clientid=($(bashio::config 'clientid')) - bashio::log.info "Set ClientId to ${clientid}" +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 ${clientid+:} ; then + #clientid=($(bashio::config 'clientid')) + bashio::log.info "Set General ClientId to ${clientid}" /usr/bin/vh_edit_config General ClientId ${clientid} fi + +if ${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 diff --git a/vhclient/rootfs/etc/s6-overlay/scripts/vhclient-add-devices b/vhclient/rootfs/etc/s6-overlay/scripts/vhclient-use-devices similarity index 100% rename from vhclient/rootfs/etc/s6-overlay/scripts/vhclient-add-devices rename to vhclient/rootfs/etc/s6-overlay/scripts/vhclient-use-devices diff --git a/vhclient/translations/en.yaml b/vhclient/translations/en.yaml index 78f8b43..a4fc700 100644 --- a/vhclient/translations/en.yaml +++ b/vhclient/translations/en.yaml @@ -13,4 +13,4 @@ configuration: description: Specify server to connect to usbdevices: name: USB devices - description: Auto populated from server info, manually update use to true + description: Auto populated from server list, manually update use to true