diff --git a/get/CHANGELOG.md b/get/CHANGELOG.md index bf92f77..a497559 100644 --- a/get/CHANGELOG.md +++ b/get/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.1.0 + +- Added option to get development builds +- Change base images to `*-base-python:3.12-alpine3.20` + # 1.0.0 Initial release diff --git a/get/Dockerfile b/get/Dockerfile index d6d0850..5a832e8 100644 --- a/get/Dockerfile +++ b/get/Dockerfile @@ -1,8 +1,9 @@ ARG BUILD_FROM FROM $BUILD_FROM -RUN \ - wget -O /get-hacs https://raw.githubusercontent.com/hacs/get/main/get \ - && chmod +x /get-hacs +SHELL ["/bin/bash", "-o", "pipefail", "-c"] -CMD ["bash", "/get-hacs"] +COPY rootfs / +RUN apk add --no-cache git + +CMD [ "/etc/addon/run" ] diff --git a/get/build.yaml b/get/build.yaml index bf07499..c550f0e 100644 --- a/get/build.yaml +++ b/get/build.yaml @@ -1,9 +1,9 @@ build_from: - aarch64: "ghcr.io/home-assistant/aarch64-base:3.15" - amd64: "ghcr.io/home-assistant/amd64-base:3.15" - armhf: "ghcr.io/home-assistant/armhf-base:3.15" - armv7: "ghcr.io/home-assistant/armv7-base:3.15" - i386: "ghcr.io/home-assistant/i386-base:3.15" + aarch64: "ghcr.io/home-assistant/aarch64-base-python:3.12-alpine3.20" + amd64: "ghcr.io/home-assistant/amd64-base-python:3.12-alpine3.20" + armhf: "ghcr.io/home-assistant/armhf-base-python:3.12-alpine3.20" + armv7: "ghcr.io/home-assistant/armv7-base-python:3.12-alpine3.20" + i386: "ghcr.io/home-assistant/i386-base-python:3.12-alpine3.20" labels: org.opencontainers.image.title: "HACS: get" org.opencontainers.image.description: "Get HCS" diff --git a/get/config.yaml b/get/config.yaml index d0cb340..ad7fc9c 100644 --- a/get/config.yaml +++ b/get/config.yaml @@ -1,5 +1,5 @@ name: Get HACS -version: "1.0.0" +version: "1.1.0" slug: get image: "ghcr.io/hacs/{arch}-addon-get" description: The easiest way to get HACS for Home Assistant @@ -13,5 +13,7 @@ arch: - amd64 - i386 init: false +schema: + channel: list(current|development)? map: - homeassistant_config:rw diff --git a/get/rootfs/etc/addon/run b/get/rootfs/etc/addon/run new file mode 100755 index 0000000..d266358 --- /dev/null +++ b/get/rootfs/etc/addon/run @@ -0,0 +1,49 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash + +CHANNEL=$(bashio::config 'channel' 'current') + +bashio::log.info "------------------------------------" +bashio::log.info "Starting HACS download..." +bashio::log.info "Channel: ${CHANNEL}" +bashio::log.info "------------------------------------" + + +if bashio::var.equals "${CHANNEL}" "current"; then + wget -O ./get-hacs https://raw.githubusercontent.com/hacs/get/main/get + chmod +x ./get-hacs + bash ./get-hacs + +elif bashio::var.equals "${CHANNEL}" "development"; then + bashio::log.info "Downloading the integration source..." + if bashio::fs.directory_exists "/tmp/hacs"; then + bashio::log.info "Cleaning up the previous download..." + rm -rf /tmp/hacs + fi + + git clone --depth 1 --branch main https://github.com/hacs/integration.git /tmp/hacs + + cd /tmp/hacs || bashio::exit.nok "Could not find the integration source" + + bashio::log.info "Installing the frontend..." + bash ./scripts/install/frontend + + bashio::log.info "Injecting a version..." + current_version=$(curl -sSL https://data-v2.hacs.xyz/integration/data.json | jq -r '.["172733314"].last_version') + updated_version="$(echo "${current_version}" | awk -F. -v OFS=. '{$NF += 1 ; print}').dev$(git rev-parse --short HEAD)" + python3 ./scripts/update/manifest.py --version "${updated_version}" + bashio::log.info "Version set to: ${updated_version}" + + bashio::log.info "Copying the integration source..." + cd / + rm -rf /homeassistant/custom_components/hacs + mv /tmp/hacs/custom_components/hacs /homeassistant/custom_components/hacs + rm -rf /tmp/hacs + + bashio::log.info "Download complete..." + bashio::log.info "Remember to restart Home Assistant before you configure it..." + +else + bashio::exit.nok "Invalid channel!" + +fi diff --git a/get/translations/en.yaml b/get/translations/en.yaml new file mode 100644 index 0000000..473c3e0 --- /dev/null +++ b/get/translations/en.yaml @@ -0,0 +1,4 @@ +configuration: + channel: + name: Channel + description: What channel should be used to download HACS.