From 529ac8f93099650061a0a02a11a837e564f9749a Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 16 Apr 2020 19:54:12 +0200 Subject: [PATCH] configurator: Version 5.0.0 (#1229) --- configurator/CHANGELOG.md | 5 ++++ configurator/Dockerfile | 22 +++++++++----- configurator/build.json | 10 +++---- configurator/config.json | 3 +- .../{data => rootfs/etc}/configurator.conf | 2 +- .../rootfs/etc/services.d/configurator/finish | 8 +++++ .../etc/services.d/configurator/run} | 29 ++++++++----------- configurator/rootfs/root/.ssh/config | 2 ++ 8 files changed, 50 insertions(+), 31 deletions(-) rename configurator/{data => rootfs/etc}/configurator.conf (91%) create mode 100644 configurator/rootfs/etc/services.d/configurator/finish rename configurator/{data/run.sh => rootfs/etc/services.d/configurator/run} (55%) mode change 100755 => 100644 create mode 100644 configurator/rootfs/root/.ssh/config diff --git a/configurator/CHANGELOG.md b/configurator/CHANGELOG.md index 7a374da..9b15782 100644 --- a/configurator/CHANGELOG.md +++ b/configurator/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 5.0.0 + +- Rewrite add-on to S6 Overlay +- Reduced add-on size + ## 4.7 - Fix file history width diff --git a/configurator/Dockerfile b/configurator/Dockerfile index a39930a..6e0d34f 100644 --- a/configurator/Dockerfile +++ b/configurator/Dockerfile @@ -2,15 +2,23 @@ ARG BUILD_FROM FROM $BUILD_FROM # Setup base +ARG BUILD_ARCH ARG CONFIGURATOR_VERSION -RUN apk add --no-cache \ +RUN \ + apk add --no-cache \ git \ openssh-client \ - && pip install --no-cache-dir \ - hass-configurator==${CONFIGURATOR_VERSION} + python3 \ + && pip3 install \ + --no-cache-dir \ + --prefer-binary \ + --find-links "https://wheels.home-assistant.io/alpine-3.11/${BUILD_ARCH}/" \ + hass-configurator=="${CONFIGURATOR_VERSION}" \ + \ + && find /usr/local \ + \( -type d -a -name test -o -name tests -o -name '__pycache__' \) \ + -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + -exec rm -rf '{}' + # Copy data -COPY data/configurator.conf /etc/ -COPY data/run.sh / - -CMD ["/run.sh"] +COPY rootfs / diff --git a/configurator/build.json b/configurator/build.json index bcf16a6..9c0fa36 100644 --- a/configurator/build.json +++ b/configurator/build.json @@ -1,10 +1,10 @@ { "build_from": { - "aarch64": "homeassistant/aarch64-base-python:3.7", - "amd64": "homeassistant/amd64-base-python:3.7", - "armhf": "homeassistant/armhf-base-python:3.7", - "armv7": "homeassistant/armv7-base-python:3.7", - "i386": "homeassistant/i386-base-python:3.7" + "aarch64": "homeassistant/aarch64-base:3.11", + "amd64": "homeassistant/amd64-base:3.11", + "armhf": "homeassistant/armhf-base:3.11", + "armv7": "homeassistant/armv7-base:3.11", + "i386": "homeassistant/i386-base:3.11" }, "args": { "CONFIGURATOR_VERSION": "0.4.0" diff --git a/configurator/config.json b/configurator/config.json index 7d1150d..a5054d2 100644 --- a/configurator/config.json +++ b/configurator/config.json @@ -1,12 +1,13 @@ { "name": "File editor", - "version": "4.7", + "version": "5.0.0", "slug": "configurator", "description": "Simple browser-based file editor for Home Assistant", "url": "https://github.com/home-assistant/hassio-addons/tree/master/configurator", "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"], "homeassistant": "0.91.1", "startup": "application", + "init": false, "ingress": true, "panel_icon": "mdi:wrench", "homeassistant_api": true, diff --git a/configurator/data/configurator.conf b/configurator/rootfs/etc/configurator.conf similarity index 91% rename from configurator/data/configurator.conf rename to configurator/rootfs/etc/configurator.conf index e9f3bb4..aa9e267 100644 --- a/configurator/data/configurator.conf +++ b/configurator/rootfs/etc/configurator.conf @@ -7,7 +7,7 @@ "SSL_CERTIFICATE": null, "SSL_KEY": null, "IGNORE_SSL": false, - "HASS_API": "http://hassio/homeassistant/api/", + "HASS_API": "http://supervisor/homeassistant/api/", "HASS_WS_API": null, "HASS_API_PASSWORD": null, "USERNAME": null, diff --git a/configurator/rootfs/etc/services.d/configurator/finish b/configurator/rootfs/etc/services.d/configurator/finish new file mode 100644 index 0000000..a29ced9 --- /dev/null +++ b/configurator/rootfs/etc/services.d/configurator/finish @@ -0,0 +1,8 @@ +#!/usr/bin/execlineb -S1 +# ============================================================================== +# Take down the S6 supervision tree based on service exit code +# ============================================================================== +if { s6-test ${1} -ne 0 } +if { s6-test ${1} -ne 256 } + +s6-svscanctl -t /var/run/s6/services diff --git a/configurator/data/run.sh b/configurator/rootfs/etc/services.d/configurator/run old mode 100755 new mode 100644 similarity index 55% rename from configurator/data/run.sh rename to configurator/rootfs/etc/services.d/configurator/run index 36f7ecf..c239c91 --- a/configurator/data/run.sh +++ b/configurator/rootfs/etc/services.d/configurator/run @@ -1,9 +1,11 @@ -#!/usr/bin/env bashio -set -e - -DIRSFIRST=$(bashio::config 'dirsfirst') -ENFORCE_BASEPATH=$(bashio::config 'enforce_basepath') -IGNORE_PATTERN="$(bashio::config 'ignore_pattern | join(",")')" +#!/usr/bin/with-contenv bashio +# ============================================================================== +# Start Configurator service +# ============================================================================== +export HC_DIRSFIRST +export HC_ENFORCE_BASEPATH +export HC_HASS_API_PASSWORD +export HC_IGNORE_PATTERN # If any SSH key files are defined in the configuration options, add them for use by git if bashio::config.has_value "ssh_keys"; then @@ -20,19 +22,12 @@ if bashio::config.has_value "ssh_keys"; then bashio::log.error "SSH key file \"${filename}\" not found" fi done <<< "$(bashio::config 'ssh_keys')" - - # Disable strict host key checking - mkdir -p ~/.ssh - { - echo "Host *" - echo " StrictHostKeyChecking no" - } > ~/.ssh/config fi # Setup and run configurator -export HC_HASS_API_PASSWORD="${HASSIO_TOKEN}" -export HC_DIRSFIRST="${DIRSFIRST}" -export HC_ENFORCE_BASEPATH="${ENFORCE_BASEPATH}" -export HC_IGNORE_PATTERN="${IGNORE_PATTERN}" +HC_DIRSFIRST=$(bashio::config 'dirsfirst') +HC_ENFORCE_BASEPATH=$(bashio::config 'enforce_basepath') +HC_HASS_API_PASSWORD="${SUPERVISOR_TOKEN}" +HC_IGNORE_PATTERN="$(bashio::config 'ignore_pattern | join(",")')" exec hass-configurator /etc/configurator.conf diff --git a/configurator/rootfs/root/.ssh/config b/configurator/rootfs/root/.ssh/config new file mode 100644 index 0000000..f30d239 --- /dev/null +++ b/configurator/rootfs/root/.ssh/config @@ -0,0 +1,2 @@ +Host * + StrictHostKeyChecking no