mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-07-28 15:36:29 +00:00
Download latest stable Supervisor after device wipe (#2765)
* Download latest stable Supervisor after device wipe Currently we download the latest tag after a device wipe, which gives us the latest Supervisor (which quite likely can be a development version). Use the stable version file instead to get the tag to be used to download the Supervisor. * Delete potentially corrupted updater info
This commit is contained in:
parent
8d6b4eb11b
commit
7870a1d78e
@ -43,21 +43,28 @@ fi
|
|||||||
if [ -z "${SUPERVISOR_IMAGE_ID}" ]; then
|
if [ -z "${SUPERVISOR_IMAGE_ID}" ]; then
|
||||||
# Get the latest from update information
|
# Get the latest from update information
|
||||||
# Using updater information instead of config. If the config version is
|
# Using updater information instead of config. If the config version is
|
||||||
# broken, this creates a way (e.g., bad release).
|
# broken, this creates a way back (e.g., bad release).
|
||||||
SUPERVISOR_VERSION=$(jq -r '.supervisor // "latest"' "${SUPERVISOR_DATA}/updater.json" || echo "latest")
|
SUPERVISOR_VERSION=$(jq -r '.supervisor // "stable"' "${SUPERVISOR_DATA}/updater.json" || echo "stable")
|
||||||
|
|
||||||
|
# Get version from stable channel in case we have no local version
|
||||||
|
# information.
|
||||||
|
if [ "${SUPERVISOR_VERSION}" = "stable" ]; then
|
||||||
|
SUPERVISOR_VERSION="$(curl -s --location https://version.home-assistant.io/stable.json | jq -e -r '.supervisor')"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[WARNING] Supervisor image missing, downloading a fresh one: ${SUPERVISOR_VERSION}"
|
echo "[WARNING] Supervisor image missing, downloading a fresh one: ${SUPERVISOR_VERSION}"
|
||||||
|
|
||||||
# Pull in the Supervisor
|
# Pull in the Supervisor
|
||||||
if docker pull "${SUPERVISOR_IMAGE}:${SUPERVISOR_VERSION}"; then
|
if docker pull "${SUPERVISOR_IMAGE}:${SUPERVISOR_VERSION}"; then
|
||||||
# Tag as latest if versioned
|
# Tag as latest
|
||||||
if [ "${SUPERVISOR_VERSION}" != "latest" ]; then
|
docker tag "${SUPERVISOR_IMAGE}:${SUPERVISOR_VERSION}" "${SUPERVISOR_IMAGE}:latest"
|
||||||
docker tag "${SUPERVISOR_IMAGE}:${SUPERVISOR_VERSION}" "${SUPERVISOR_IMAGE}:latest"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
# Pull failed, updater info might be corrupted, re-trying with latest
|
# Pull failed, updater info might be corrupted or the release might have
|
||||||
echo "[WARNING] Supervisor downloading failed trying: latest"
|
# been removed from the container registry, delete the updater info
|
||||||
docker pull "${SUPERVISOR_IMAGE}:latest"
|
# to start from scratch on next try.
|
||||||
|
echo "[ERROR] Supervisor downloading failed."
|
||||||
|
rm -f "${SUPERVISOR_DATA}/updater.json"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SUPERVISOR_IMAGE_ID=$(docker inspect --format='{{.Id}}' "${SUPERVISOR_IMAGE}" || echo "")
|
SUPERVISOR_IMAGE_ID=$(docker inspect --format='{{.Id}}' "${SUPERVISOR_IMAGE}" || echo "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user