mirror of
https://github.com/hassio-addons/bashio.git
synced 2025-05-06 20:11:24 +00:00
Fix and improve update_available logic for all plugins (#47)
This commit is contained in:
parent
b5a32fe006
commit
abd81ec1c9
6 changed files with 12 additions and 54 deletions
|
@ -438,20 +438,11 @@ function bashio::addon.version_latest() {
|
||||||
# $1 Add-on slug (optional, default: self)
|
# $1 Add-on slug (optional, default: self)
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
function bashio::addon.update_available() {
|
function bashio::addon.update_available() {
|
||||||
local addon=${1:-'self'}
|
|
||||||
local version
|
|
||||||
local version_latest
|
|
||||||
|
|
||||||
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
||||||
|
bashio::addons \
|
||||||
version=$(bashio::addon.version "${addon}")
|
"${slug}" \
|
||||||
version_latest=$(bashio::addon.version_latest "${addon}")
|
"addons.${slug}.update_available" \
|
||||||
|
'.update_available // false'
|
||||||
if [[ "${version}" = "${version_latest}" ]]; then
|
|
||||||
return "${__BASHIO_EXIT_NOK}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return "${__BASHIO_EXIT_OK}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
15
lib/audio.sh
15
lib/audio.sh
|
@ -111,19 +111,8 @@ function bashio::audio.version_latest() {
|
||||||
# Checks if there is an update available for the audio server.
|
# Checks if there is an update available for the audio server.
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
function bashio::audio.update_available() {
|
function bashio::audio.update_available() {
|
||||||
local version
|
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
||||||
local version_latest
|
bashio::audio 'audio.info.update_available' '.update_available // false'
|
||||||
|
|
||||||
bashio::log.trace "${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
version=$(bashio::audio.version)
|
|
||||||
version_latest=$(bashio::audio.version_latest)
|
|
||||||
|
|
||||||
if [[ "${version}" = "${version_latest}" ]]; then
|
|
||||||
return "${__BASHIO_EXIT_NOK}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return "${__BASHIO_EXIT_OK}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -134,7 +134,7 @@ function bashio::core.version_latest() {
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
function bashio::core.update_available() {
|
function bashio::core.update_available() {
|
||||||
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
||||||
bashio::cli 'core.info.update_available' '.update_available // false'
|
bashio::core 'core.info.update_available' '.update_available // false'
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -120,7 +120,7 @@ function bashio::dns.version_latest() {
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
function bashio::dns.update_available() {
|
function bashio::dns.update_available() {
|
||||||
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
||||||
bashio::cli 'dns.info.update_available' '.update_available // false'
|
bashio::dns 'dns.info.update_available' '.update_available // false'
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
15
lib/os.sh
15
lib/os.sh
|
@ -93,19 +93,8 @@ function bashio::os.version_latest() {
|
||||||
# Checks if there is an update available for the Supervisor.
|
# Checks if there is an update available for the Supervisor.
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
function bashio::os.update_available() {
|
function bashio::os.update_available() {
|
||||||
local version
|
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
||||||
local version_latest
|
bashio::os 'os.info.update_available' '.update_available // false'
|
||||||
|
|
||||||
bashio::log.trace "${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
version=$(bashio::os.version)
|
|
||||||
version_latest=$(bashio::os.version_latest)
|
|
||||||
|
|
||||||
if [[ "${version}" = "${version_latest}" ]]; then
|
|
||||||
return "${__BASHIO_EXIT_NOK}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return "${__BASHIO_EXIT_OK}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
|
@ -110,19 +110,8 @@ function bashio::supervisor.version_latest() {
|
||||||
# Checks if there is an update available for the Supervisor.
|
# Checks if there is an update available for the Supervisor.
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
function bashio::supervisor.update_available() {
|
function bashio::supervisor.update_available() {
|
||||||
local version
|
bashio::log.trace "${FUNCNAME[0]}" "$@"
|
||||||
local version_latest
|
bashio::supervisor 'supervisor.info.update_available' '.update_available // false'
|
||||||
|
|
||||||
bashio::log.trace "${FUNCNAME[0]}"
|
|
||||||
|
|
||||||
version=$(bashio::supervisor.version)
|
|
||||||
version_latest=$(bashio::supervisor.version_latest)
|
|
||||||
|
|
||||||
if [[ "${version}" = "${version_latest}" ]]; then
|
|
||||||
return "${__BASHIO_EXIT_NOK}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
return "${__BASHIO_EXIT_OK}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue