Add Kconfig option for Supervisor channel (#3618)

* Add Makefile variable for Supervisor channel

Allow to set the release channel pre-installed Home Assistant components
like Supervisor and add-on are fetched from. This channel is then also
used at runtime.

* Use choice instead of string variable

* Fix channel in Supervisor updater.json config

* Add newlines
This commit is contained in:
Stefan Agner 2024-11-18 14:39:46 +01:00 committed by GitHub
parent 71e580175e
commit f169f78bb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 40 additions and 5 deletions

View File

@ -18,4 +18,27 @@ config BR2_PACKAGE_HASSIO_MACHINE
help
Machine to pull containers for (used for landing page).
choice
prompt "Default Channel"
default BR2_PACKAGE_HASSIO_CHANNEL_STABLE
help
Channel to use by default.
config BR2_PACKAGE_HASSIO_CHANNEL_STABLE
bool "Stable"
help
Stable channel.
config BR2_PACKAGE_HASSIO_CHANNEL_BETA
bool "Beta"
help
Beta channel.
config BR2_PACKAGE_HASSIO_CHANNEL_DEV
bool "Dev"
help
Dev channel.
endchoice
endif

View File

@ -3,6 +3,7 @@ set -e
build_dir=$1
dst_dir=$2
channel=$3
data_img="${dst_dir}/data.ext4"
@ -24,7 +25,7 @@ container=$(docker run --privileged -e DOCKER_TLS_CERTDIR="" \
-v "${build_dir}":/build \
-d docker:27.2-dind --storage-driver overlay2)
docker exec "${container}" sh /build/dind-import-containers.sh
docker exec "${container}" sh /build/dind-import-containers.sh "${channel}"
docker stop "${container}"

View File

@ -1,6 +1,8 @@
#!/bin/sh
set -e
channel=$1
APPARMOR_URL="https://version.home-assistant.io/apparmor.txt"
# Make sure we can talk to the Docker daemon
@ -27,3 +29,5 @@ docker tag "${supervisor}" "ghcr.io/home-assistant/${arch}-hassio-supervisor:lat
# Setup AppArmor
mkdir -p "/data/supervisor/apparmor"
wget -O "/data/supervisor/apparmor/hassio-supervisor" "${APPARMOR_URL}"
echo "{ \"channel\": \"${channel}\" }" > /data/supervisor/updater.json

View File

@ -9,13 +9,20 @@ HASSIO_LICENSE = Apache License 2.0
# HASSIO_LICENSE_FILES = $(BR2_EXTERNAL_HASSOS_PATH)/../LICENSE
HASSIO_SITE = $(BR2_EXTERNAL_HASSOS_PATH)/package/hassio
HASSIO_SITE_METHOD = local
HASSIO_VERSION_URL = "https://version.home-assistant.io/stable.json"
HASSIO_VERSION_URL = "https://version.home-assistant.io/"
ifeq ($(BR2_PACKAGE_HASSIO_CHANNEL_STABLE),y)
HASSIO_VERSION_CHANNEL = "stable"
else ifeq ($(BR2_PACKAGE_HASSIO_CHANNEL_BETA),y)
HASSIO_VERSION_CHANNEL = "beta"
else ifeq ($(BR2_PACKAGE_HASSIO_CHANNEL_DEV),y)
HASSIO_VERSION_CHANNEL = "dev"
endif
HASSIO_CONTAINER_IMAGES_ARCH = supervisor dns audio cli multicast observer core
define HASSIO_CONFIGURE_CMDS
# Deploy only landing page for "core" by setting version to "landingpage"
curl -s $(HASSIO_VERSION_URL) | jq '.core = "landingpage"' > $(@D)/stable.json
curl -s $(HASSIO_VERSION_URL)$(HASSIO_VERSION_CHANNEL)".json" | jq '.core = "landingpage"' > $(@D)/version.json
endef
define HASSIO_BUILD_CMDS
@ -23,14 +30,14 @@ define HASSIO_BUILD_CMDS
$(Q)mkdir -p $(HASSIO_DL_DIR)
$(foreach image,$(HASSIO_CONTAINER_IMAGES_ARCH),\
$(BR2_EXTERNAL_HASSOS_PATH)/package/hassio/fetch-container-image.sh \
$(BR2_PACKAGE_HASSIO_ARCH) $(BR2_PACKAGE_HASSIO_MACHINE) $(@D)/stable.json $(image) "$(HASSIO_DL_DIR)" "$(@D)/images"
$(BR2_PACKAGE_HASSIO_ARCH) $(BR2_PACKAGE_HASSIO_MACHINE) $(@D)/version.json $(image) "$(HASSIO_DL_DIR)" "$(@D)/images"
)
endef
HASSIO_INSTALL_IMAGES = YES
define HASSIO_INSTALL_IMAGES_CMDS
$(BR2_EXTERNAL_HASSOS_PATH)/package/hassio/create-data-partition.sh "$(@D)" "$(BINARIES_DIR)"
$(BR2_EXTERNAL_HASSOS_PATH)/package/hassio/create-data-partition.sh "$(@D)" "$(BINARIES_DIR)" "$(HASSIO_VERSION_CHANNEL)"
endef
$(eval $(generic-package))