This commit is contained in:
Hans Karlinius
2024-12-01 09:05:36 +01:00
parent 16b1fd12b5
commit cb43bd7793
9 changed files with 44 additions and 23 deletions

View File

@@ -30,7 +30,6 @@ usb: true
usbip: true usbip: true
kernel_modules: true kernel_modules: true
options: options:
updateconfig: true
autouse: true autouse: true
autofind: true autofind: true
clientid: '' clientid: ''
@@ -46,6 +45,7 @@ schema:
device: str?, device: str?,
use: bool? use: bool?
}] }]
preventconfig: bool
stage: experimental stage: experimental
init: false init: false

View File

@@ -1,8 +1,8 @@
#!/command/with-contenv bashio #!/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') #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 #if $autofind; then
# bashio::log.info "Enable AutoFind" # 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 # /usr/bin/vh_edit_config General AutoFind 0
#fi #fi
if $autouse; then #if $autouse; then
bashio::log.info "AUTO USE ALL" # bashio::log.info "AUTO USE ALL"
/usr/bin/vhclient -t "AUTO USE ALL" # /usr/bin/vhclient -t "AUTO USE ALL"
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"
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
#if bashio::config.has_value 'clientid'; then #if bashio::config.has_value 'clientid'; then
# clientid=($(bashio::config 'clientid')) # clientid=($(bashio::config 'clientid'))
@@ -28,8 +28,8 @@ fi
# /usr/bin/vh_edit_config General ClientId ${clientid} # /usr/bin/vh_edit_config General ClientId ${clientid}
#fi #fi
if bashio::config.has_value 'manualhub'; then #if bashio::config.has_value 'manualhub'; then
manualhub=($(bashio::config 'manualhub')) # manualhub=($(bashio::config 'manualhub'))
bashio::log.info "MANUAL HUB ADD,${manualhub}" # bashio::log.info "MANUAL HUB ADD,${manualhub}"
/usr/bin/vhclient -t "MANUAL HUB ADD,${manualhub}" # /usr/bin/vhclient -t "MANUAL HUB ADD,${manualhub}"
fi #fi

View File

@@ -2,17 +2,38 @@
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') 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 if $autofind; then
bashio::log.info "Enable AutoFind" bashio::log.info "Enable General AutoFind"
/usr/bin/vh_edit_config General AutoFind 1 /usr/bin/vh_edit_config General AutoFind 1
else else
bashio::log.info "Disable AutoFind" bashio::log.info "Disable General AutoFind"
/usr/bin/vh_edit_config General AutoFind 0 /usr/bin/vh_edit_config General AutoFind 0
fi fi
if bashio::config.has_value 'clientid'; then if $autouse; then
clientid=($(bashio::config 'clientid')) bashio::log.info "Enable AutoShare All"
bashio::log.info "Set ClientId to ${clientid}" /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} /usr/bin/vh_edit_config General ClientId ${clientid}
fi 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

View File

@@ -13,4 +13,4 @@ configuration:
description: Specify server to connect to description: Specify server to connect to
usbdevices: usbdevices:
name: USB devices 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