mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-07 04:21:29 +00:00
Compare commits
9 commits
Author | SHA1 | Date | |
---|---|---|---|
|
5059ff133e | ||
|
445707a903 | ||
|
d70505aada | ||
|
e297fa5c2c | ||
|
c6de3e5756 | ||
|
b0219ef6f1 | ||
|
2b21846d28 | ||
|
dc3e044064 | ||
|
f3bd57130c |
20 changed files with 132 additions and 8 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
@ -39,7 +39,7 @@ jobs:
|
|||
- name: ⤵️ Check out code from GitHub
|
||||
uses: actions/checkout@v4
|
||||
- name: 🚀 Run YAMLLint
|
||||
uses: frenck/action-yamllint@v1.4
|
||||
uses: frenck/action-yamllint@v1.5
|
||||
|
||||
lint-prettier:
|
||||
name: Prettier
|
||||
|
|
2
.github/workflows/release-drafter.yaml
vendored
2
.github/workflows/release-drafter.yaml
vendored
|
@ -13,6 +13,6 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🚀 Run Release Drafter
|
||||
uses: release-drafter/release-drafter@v5.25.0
|
||||
uses: release-drafter/release-drafter@v6.1.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# MIT License
|
||||
|
||||
Copyright (c) 2019-2023 Franck Nijhof
|
||||
Copyright (c) 2019-2025 Franck Nijhof
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -147,7 +147,7 @@ check [the contributor's page][contributors].
|
|||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019-2023 Franck Nijhof
|
||||
Copyright (c) 2019-2025 Franck Nijhof
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -185,7 +185,7 @@ SOFTWARE.
|
|||
[issue]: https://github.com/hassio-addons/bashio/issues
|
||||
[keepchangelog]: http://keepachangelog.com/en/1.0.0/
|
||||
[license-shield]: https://img.shields.io/github/license/hassio-addons/bashio.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2023.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2025.svg
|
||||
[patreon-shield]: https://frenck.dev/wp-content/uploads/2019/12/patreon.png
|
||||
[patreon]: https://www.patreon.com/frenck
|
||||
[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg
|
||||
|
|
|
@ -164,6 +164,10 @@ function bashio::addons() {
|
|||
info=$(bashio::cache.get 'addons.list')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/addons" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get addons from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "addons.list" "${info}"
|
||||
fi
|
||||
else
|
||||
|
@ -171,6 +175,10 @@ function bashio::addons() {
|
|||
info=$(bashio::cache.get "addons.${slug}.info")
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/addons/${slug}/info" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get addon info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "addons.${slug}.info" "${info}"
|
||||
fi
|
||||
fi
|
||||
|
@ -1202,6 +1210,10 @@ function bashio::addon.stats() {
|
|||
info=$(bashio::cache.get "addons.${slug}.stats")
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/addons/${slug}/stats" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get addon stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "addons.${slug}.stats" "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -77,6 +77,10 @@ function bashio::audio() {
|
|||
info=$(bashio::cache.get 'audio.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /audio/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get audio info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'audio.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -147,6 +151,10 @@ function bashio::audio.stats() {
|
|||
info=$(bashio::cache.get 'audio.stats')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /audio/stats false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get audio stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'audio.stats' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -51,6 +51,10 @@ function bashio::cli() {
|
|||
info=$(bashio::cache.get 'cli.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /cli/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get cli info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'cli.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -113,6 +117,10 @@ function bashio::cli.stats() {
|
|||
info=$(bashio::cache.get 'cli.stats')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /cli/stats false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get cli stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'cli.stats' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -99,6 +99,10 @@ function bashio::core() {
|
|||
info=$(bashio::cache.get 'core.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /core/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get core info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'core.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -249,6 +253,10 @@ function bashio::core.stats() {
|
|||
info=$(bashio::cache.get 'core.stats')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /core/stats false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get core stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'core.stats' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -77,6 +77,10 @@ function bashio::dns() {
|
|||
info=$(bashio::cache.get 'dns.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /dns/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get dns info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'dns.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -163,6 +167,10 @@ function bashio::dns.stats() {
|
|||
info=$(bashio::cache.get 'dns.stats')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /dns/stats false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get dns stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'dns.stats' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@ function bashio::hardware() {
|
|||
info=$(bashio::cache.get 'hardware.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /hardware/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get hardware info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'hardware.info' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ function bashio::host() {
|
|||
info=$(bashio::cache.get 'host.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /host/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get host info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'host.info' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@ function bashio::info() {
|
|||
info=$(bashio::cache.get 'info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'info' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -68,6 +68,10 @@ function bashio::multicast() {
|
|||
info=$(bashio::cache.get 'multicast.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /multicast/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get multicast info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'multicast.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -130,6 +134,10 @@ function bashio::multicast.stats() {
|
|||
info=$(bashio::cache.get 'multicast.stats')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /multicast/stats false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get multicast stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'multicast.stats' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -41,6 +41,10 @@ function bashio::network() {
|
|||
info=$(bashio::cache.get 'network.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /network/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get network info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'network.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -105,6 +109,10 @@ function bashio::network.interface() {
|
|||
info=$(bashio::cache.get "network.interface.${interface}.info")
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/network/interface/${interface}/info" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get network interface info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "network.interface.${interface}.info" "${info}"
|
||||
fi
|
||||
|
||||
|
@ -164,7 +172,7 @@ function bashio::network.enabled() {
|
|||
# Arguments:
|
||||
# $1 Interface name for this operation (optional)
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::network.enabled() {
|
||||
function bashio::network.connected() {
|
||||
local interface=${1:-'default'}
|
||||
|
||||
bashio::log.trace "${FUNCNAME[0]}"
|
||||
|
|
|
@ -51,6 +51,10 @@ function bashio::observer() {
|
|||
info=$(bashio::cache.get 'observer.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /observer/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get observer info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'observer.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -121,6 +125,10 @@ function bashio::observer.stats() {
|
|||
info=$(bashio::cache.get 'observer.stats')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /observer/stats false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get observer stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'observer.stats' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -59,6 +59,10 @@ function bashio::os() {
|
|||
info=$(bashio::cache.get 'os.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /os/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get os info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'os.info' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@ function bashio::repositories() {
|
|||
info=$(bashio::cache.get 'repositories.list')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET "/addons" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get addons from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "repositories.list" "${info}"
|
||||
fi
|
||||
else
|
||||
|
@ -42,6 +46,10 @@ function bashio::repositories() {
|
|||
else
|
||||
info=$(bashio::api.supervisor GET "/addons" \
|
||||
false ".repositories[] | select(.slug==\"${slug}\")")
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get repositories info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "repositories.${slug}.info" "${info}"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -28,6 +28,10 @@ function bashio::services() {
|
|||
config=$(bashio::cache.get "${cache_key}")
|
||||
else
|
||||
config=$(bashio::api.supervisor GET "/services/${service}" false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get services from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set "${cache_key}" "${config}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -76,6 +76,10 @@ function bashio::supervisor() {
|
|||
info=$(bashio::cache.get 'supervisor.info')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /supervisor/info false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get supervisor info from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'supervisor.info' "${info}"
|
||||
fi
|
||||
|
||||
|
@ -178,6 +182,26 @@ function bashio::supervisor.timezone() {
|
|||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Returns or sets the current country of the system.
|
||||
#
|
||||
# Arguments:
|
||||
# $1 Country to set (optional).
|
||||
# ------------------------------------------------------------------------------
|
||||
function bashio::supervisor.country() {
|
||||
local country=${1:-}
|
||||
|
||||
bashio::log.trace "${FUNCNAME[0]}:" "$@"
|
||||
|
||||
if bashio::var.has_value "${country}"; then
|
||||
channel=$(bashio::var.json country "${country}")
|
||||
bashio::api.supervisor POST /supervisor/options "${country}"
|
||||
bashio::cache.flush_all
|
||||
else
|
||||
bashio::supervisor 'supervisor.info.country' '.country'
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Returns the current logging level of the Supervisor.
|
||||
#
|
||||
|
@ -314,6 +338,10 @@ function bashio::supervisor.stats() {
|
|||
info=$(bashio::cache.get 'supervisor.stats')
|
||||
else
|
||||
info=$(bashio::api.supervisor GET /supervisor/stats false)
|
||||
if [ "$?" -ne "${__BASHIO_EXIT_OK}" ]; then
|
||||
bashio::log.error "Failed to get supervisor stats from Supervisor API"
|
||||
return "${__BASHIO_EXIT_NOK}"
|
||||
fi
|
||||
bashio::cache.set 'supervisor.stats' "${info}"
|
||||
fi
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# ==============================================================================
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Checks if a give value is true.
|
||||
# Checks if a given value is true.
|
||||
#
|
||||
# Arguments:
|
||||
# $1 value
|
||||
|
@ -26,7 +26,7 @@ function bashio::var.true() {
|
|||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Checks if a give value is false.
|
||||
# Checks if a given value is false.
|
||||
#
|
||||
# Arguments:
|
||||
# $1 value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue