diff --git a/Dockerfile b/Dockerfile index 82ff0b9..9310aba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,98 +9,100 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA LABEL maintainer="saarg, roxedus" # environment settings -ENV PIPFLAGS="--no-cache-dir --use-deprecated=legacy-resolver --find-links https://wheel-index.linuxserver.io/alpine/ --find-links https://wheel-index.linuxserver.io/homeassistant/" PYTHONPATH="${PYTHONPATH}:/pip-packages" +ENV \ + PIPFLAGS="--no-cache-dir --use-deprecated=legacy-resolver --find-links https://wheel-index.linuxserver.io/alpine/ --find-links https://wheel-index.linuxserver.io/homeassistant/" \ + PYTHONPATH="${PYTHONPATH}:/pip-packages" # copy local files COPY root/ / -# https://github.com/home-assistant/core/pull/43771 +#https://github.com/home-assistant/core/pull/59769 # install packages RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - autoconf \ - ca-certificates \ - cargo \ - cmake \ - eudev-dev \ - ffmpeg-dev \ - gcc \ - g++ \ - jq \ - libffi-dev \ - jpeg-dev \ - libxml2-dev \ - libxslt-dev \ - make \ - postgresql-dev \ - python3-dev \ - unixodbc-dev \ - unzip && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache \ - bluez-deprecated \ - curl \ - eudev-libs \ - ffmpeg \ - iputils \ - libcap \ - libjpeg-turbo \ - libstdc++ \ - libxslt \ - mariadb-connector-c \ - mariadb-connector-c-dev \ - openssh-client \ - openssl \ - postgresql-libs \ - py3-pip \ - python3 \ - tiff && \ - echo "**** install homeassistant ****" && \ - mkdir -p \ - /tmp/core && \ - if [ -z ${HASS_RELEASE+x} ]; then \ - HASS_RELEASE=$(curl -sX GET https://api.github.com/repos/home-assistant/core/releases/latest \ - | jq -r .tag_name); \ - fi && \ - curl -o \ - /tmp/core.tar.gz -L \ - "https://github.com/home-assistant/core/archive/${HASS_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/core.tar.gz -C \ - /tmp/core --strip-components=1 && \ - HASS_BASE=$(cat /tmp/core/build.yaml \ - | grep 'amd64: ' \ - | cut -d: -f3) && \ - mkdir -p /pip-packages && \ - pip install --target /pip-packages --no-cache-dir --upgrade \ - distlib && \ - pip install --no-cache-dir --upgrade \ - cython \ - "pip>=21.0,<22.1" \ - setuptools \ - wheel && \ - cd /tmp/core && \ - pip install ${PIPFLAGS} \ - -r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \ - pip install ${PIPFLAGS} \ - -r requirements_all.txt && \ - pip install ${PIPFLAGS} \ - homeassistant==${HASS_RELEASE} && \ - pip install ${PIPFLAGS} \ - PySwitchbot && \ - echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ - for cleanfiles in *.pyc *.pyo; \ - do \ - find /usr/lib/python3.* -iname "${cleanfiles}" -exec rm -f '{}' + \ - ; done && \ - rm -rf \ - /tmp/* \ - /root/.cache \ - /root/.cargo + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ + autoconf \ + ca-certificates \ + cargo \ + cmake \ + eudev-dev \ + ffmpeg-dev \ + gcc \ + g++ \ + jq \ + libffi-dev \ + jpeg-dev \ + libxml2-dev \ + libxslt-dev \ + make \ + postgresql-dev \ + python3-dev \ + unixodbc-dev \ + unzip && \ + echo "**** install runtime packages ****" && \ + apk add --no-cache \ + bluez-deprecated \ + curl \ + eudev-libs \ + ffmpeg \ + iputils \ + libcap \ + libjpeg-turbo \ + libstdc++ \ + libxslt \ + mariadb-connector-c \ + mariadb-connector-c-dev \ + openssh-client \ + openssl \ + postgresql-libs \ + py3-pip \ + python3 \ + tiff && \ + echo "**** install homeassistant ****" && \ + mkdir -p \ + /tmp/core && \ + if [ -z ${HASS_RELEASE+x} ]; then \ + HASS_RELEASE=$(curl -sX GET https://api.github.com/repos/home-assistant/core/releases/latest \ + | jq -r .tag_name); \ + fi && \ + curl -o \ + /tmp/core.tar.gz -L \ + "https://github.com/home-assistant/core/archive/${HASS_RELEASE}.tar.gz" && \ + tar xf \ + /tmp/core.tar.gz -C \ + /tmp/core --strip-components=1 && \ + HASS_BASE=$(cat /tmp/core/build.yaml \ + | grep 'amd64: ' \ + | cut -d: -f3) && \ + mkdir -p /pip-packages && \ + pip install --target /pip-packages --no-cache-dir --upgrade \ + distlib && \ + pip install --no-cache-dir --upgrade \ + cython \ + "pip>=21.0,<22.1" \ + setuptools \ + wheel && \ + cd /tmp/core && \ + pip install ${PIPFLAGS} \ + -r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \ + pip install ${PIPFLAGS} \ + -r requirements_all.txt && \ + pip install ${PIPFLAGS} \ + homeassistant==${HASS_RELEASE} && \ + pip install ${PIPFLAGS} \ + PySwitchbot && \ + echo "**** cleanup ****" && \ + apk del --purge \ + build-dependencies && \ + for cleanfiles in *.pyc *.pyo; \ + do \ + find /usr/lib/python3.* -iname "${cleanfiles}" -exec rm -f '{}' + \ + ; done && \ + rm -rf \ + /tmp/* \ + /root/.cache \ + /root/.cargo # environment settings. used so pip packages installed by home assistant installs in /config ENV HOME="/config" diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 6b4c25c..edc281a 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -9,97 +9,99 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA LABEL maintainer="saarg, roxedus" # environment settings -ENV PIPFLAGS="--no-cache-dir --use-deprecated=legacy-resolver --find-links https://wheel-index.linuxserver.io/alpine/ --find-links https://wheel-index.linuxserver.io/homeassistant/" PYTHONPATH="${PYTHONPATH}:/pip-packages" +ENV \ + PIPFLAGS="--no-cache-dir --use-deprecated=legacy-resolver --find-links https://wheel-index.linuxserver.io/alpine/ --find-links https://wheel-index.linuxserver.io/homeassistant/" \ + PYTHONPATH="${PYTHONPATH}:/pip-packages" # copy local files COPY root/ / -# https://github.com/home-assistant/core/pull/43771 +#https://github.com/home-assistant/core/pull/59769 # install packages RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - autoconf \ - ca-certificates \ - cargo \ - cmake \ - eudev-dev \ - ffmpeg-dev \ - gcc \ - g++ \ - jq \ - libffi-dev \ - jpeg-dev \ - libxml2-dev \ - libxslt-dev \ - make \ - postgresql-dev \ - python3-dev \ - unixodbc-dev \ - unzip && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache \ - bluez-deprecated \ - curl \ - eudev-libs \ - ffmpeg \ - iputils \ - libcap \ - libjpeg-turbo \ - libstdc++ \ - libxslt \ - mariadb-connector-c \ - mariadb-connector-c-dev \ - openssh-client \ - openssl \ - postgresql-libs \ - py3-pip \ - python3 \ - tiff && \ - echo "**** install homeassistant ****" && \ - mkdir -p \ - /tmp/core && \ - if [ -z ${HASS_RELEASE+x} ]; then \ - HASS_RELEASE=$(curl -sX GET https://api.github.com/repos/home-assistant/core/releases/latest \ - | jq -r .tag_name); \ - fi && \ - curl -o \ - /tmp/core.tar.gz -L \ - "https://github.com/home-assistant/core/archive/${HASS_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/core.tar.gz -C \ - /tmp/core --strip-components=1 && \ - HASS_BASE=$(cat /tmp/core/build.yaml \ - | grep 'amd64: ' \ - | cut -d: -f3) && \ - pip install --target /pip-packages --no-cache-dir --upgrade \ - distlib && \ - pip install --no-cache-dir --upgrade \ - cython \ - "pip>=21.0,<22.1" \ - setuptools \ - wheel && \ - cd /tmp/core && \ - pip install ${PIPFLAGS} \ - -r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \ - pip install ${PIPFLAGS} \ - -r requirements_all.txt && \ - pip install ${PIPFLAGS} \ - homeassistant==${HASS_RELEASE} && \ - pip install ${PIPFLAGS} \ - PySwitchbot && \ - echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ - for cleanfiles in *.pyc *.pyo; \ - do \ - find /usr/lib/python3.* -iname "${cleanfiles}" -exec rm -f '{}' + \ - ; done && \ - rm -rf \ - /tmp/* \ - /root/.cache \ - /root/.cargo + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ + autoconf \ + ca-certificates \ + cargo \ + cmake \ + eudev-dev \ + ffmpeg-dev \ + gcc \ + g++ \ + jq \ + libffi-dev \ + jpeg-dev \ + libxml2-dev \ + libxslt-dev \ + make \ + postgresql-dev \ + python3-dev \ + unixodbc-dev \ + unzip && \ + echo "**** install runtime packages ****" && \ + apk add --no-cache \ + bluez-deprecated \ + curl \ + eudev-libs \ + ffmpeg \ + iputils \ + libcap \ + libjpeg-turbo \ + libstdc++ \ + libxslt \ + mariadb-connector-c \ + mariadb-connector-c-dev \ + openssh-client \ + openssl \ + postgresql-libs \ + py3-pip \ + python3 \ + tiff && \ + echo "**** install homeassistant ****" && \ + mkdir -p \ + /tmp/core && \ + if [ -z ${HASS_RELEASE+x} ]; then \ + HASS_RELEASE=$(curl -sX GET https://api.github.com/repos/home-assistant/core/releases/latest \ + | jq -r .tag_name); \ + fi && \ + curl -o \ + /tmp/core.tar.gz -L \ + "https://github.com/home-assistant/core/archive/${HASS_RELEASE}.tar.gz" && \ + tar xf \ + /tmp/core.tar.gz -C \ + /tmp/core --strip-components=1 && \ + HASS_BASE=$(cat /tmp/core/build.yaml \ + | grep 'amd64: ' \ + | cut -d: -f3) && \ + pip install --target /pip-packages --no-cache-dir --upgrade \ + distlib && \ + pip install --no-cache-dir --upgrade \ + cython \ + "pip>=21.0,<22.1" \ + setuptools \ + wheel && \ + cd /tmp/core && \ + pip install ${PIPFLAGS} \ + -r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \ + pip install ${PIPFLAGS} \ + -r requirements_all.txt && \ + pip install ${PIPFLAGS} \ + homeassistant==${HASS_RELEASE} && \ + pip install ${PIPFLAGS} \ + PySwitchbot && \ + echo "**** cleanup ****" && \ + apk del --purge \ + build-dependencies && \ + for cleanfiles in *.pyc *.pyo; \ + do \ + find /usr/lib/python3.* -iname "${cleanfiles}" -exec rm -f '{}' + \ + ; done && \ + rm -rf \ + /tmp/* \ + /root/.cache \ + /root/.cargo # environment settings. used so pip packages installed by home assistant installs in /config ENV HOME="/config" diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 62a0934..92bc0de 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -9,7 +9,9 @@ LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DA LABEL maintainer="saarg, roxedus" # environment settings -ENV PIPFLAGS="--no-cache-dir --use-deprecated=legacy-resolver --find-links https://wheel-index.linuxserver.io/alpine/ --find-links https://wheel-index.linuxserver.io/homeassistant/" PYTHONPATH="${PYTHONPATH}:/pip-packages" +ENV \ + PIPFLAGS="--no-cache-dir --use-deprecated=legacy-resolver --find-links https://wheel-index.linuxserver.io/alpine/ --find-links https://wheel-index.linuxserver.io/homeassistant/" \ + PYTHONPATH="${PYTHONPATH}:/pip-packages" # necessary args to compile grpcio on arm32v7 ARG GRPC_BUILD_WITH_BORING_SSL_ASM=false @@ -20,92 +22,92 @@ ARG GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=true # copy local files COPY root/ / -# https://github.com/home-assistant/core/pull/43771 +#https://github.com/home-assistant/core/pull/59769 # install packages RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - autoconf \ - ca-certificates \ - cargo \ - cmake \ - eudev-dev \ - ffmpeg-dev \ - gcc \ - g++ \ - jq \ - libffi-dev \ - jpeg-dev \ - libxml2-dev \ - libxslt-dev \ - make \ - postgresql-dev \ - python3-dev \ - unixodbc-dev \ - unzip && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache \ - bluez-deprecated \ - curl \ - eudev-libs \ - ffmpeg \ - iputils \ - libcap \ - libjpeg-turbo \ - libstdc++ \ - libxslt \ - mariadb-connector-c \ - mariadb-connector-c-dev \ - openssh-client \ - openssl \ - postgresql-libs \ - py3-pip \ - python3 \ - tiff && \ - echo "**** install homeassistant ****" && \ - mkdir -p \ - /tmp/core && \ - if [ -z ${HASS_RELEASE+x} ]; then \ - HASS_RELEASE=$(curl -sX GET https://api.github.com/repos/home-assistant/core/releases/latest \ - | jq -r .tag_name); \ - fi && \ - curl -o \ - /tmp/core.tar.gz -L \ - "https://github.com/home-assistant/core/archive/${HASS_RELEASE}.tar.gz" && \ - tar xf \ - /tmp/core.tar.gz -C \ - /tmp/core --strip-components=1 && \ - HASS_BASE=$(cat /tmp/core/build.yaml \ - | grep 'amd64: ' \ - | cut -d: -f3) && \ - pip install --target /pip-packages --no-cache-dir --upgrade \ - distlib && \ - pip install --no-cache-dir --upgrade \ - cython \ - "pip>=21.0,<22.1" \ - setuptools \ - wheel && \ - cd /tmp/core && \ - pip install ${PIPFLAGS} \ - -r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \ - pip install ${PIPFLAGS} \ - -r requirements_all.txt --no-binary grpcio && \ - pip install ${PIPFLAGS} \ - homeassistant==${HASS_RELEASE} && \ - pip install ${PIPFLAGS} \ - PySwitchbot && \ - echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ - for cleanfiles in *.pyc *.pyo; \ - do \ - find /usr/lib/python3.* -iname "${cleanfiles}" -exec rm -f '{}' + \ - ; done && \ - rm -rf \ - /tmp/* \ - /root/.cache \ - /root/.cargo + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ + autoconf \ + ca-certificates \ + cargo \ + cmake \ + eudev-dev \ + ffmpeg-dev \ + gcc \ + g++ \ + jq \ + libffi-dev \ + jpeg-dev \ + libxml2-dev \ + libxslt-dev \ + make \ + postgresql-dev \ + python3-dev \ + unixodbc-dev \ + unzip && \ + echo "**** install runtime packages ****" && \ + apk add --no-cache \ + bluez-deprecated \ + curl \ + eudev-libs \ + ffmpeg \ + iputils \ + libcap \ + libjpeg-turbo \ + libstdc++ \ + libxslt \ + mariadb-connector-c \ + mariadb-connector-c-dev \ + openssh-client \ + openssl \ + postgresql-libs \ + py3-pip \ + python3 \ + tiff && \ + echo "**** install homeassistant ****" && \ + mkdir -p \ + /tmp/core && \ + if [ -z ${HASS_RELEASE+x} ]; then \ + HASS_RELEASE=$(curl -sX GET https://api.github.com/repos/home-assistant/core/releases/latest \ + | jq -r .tag_name); \ + fi && \ + curl -o \ + /tmp/core.tar.gz -L \ + "https://github.com/home-assistant/core/archive/${HASS_RELEASE}.tar.gz" && \ + tar xf \ + /tmp/core.tar.gz -C \ + /tmp/core --strip-components=1 && \ + HASS_BASE=$(cat /tmp/core/build.yaml \ + | grep 'amd64: ' \ + | cut -d: -f3) && \ + pip install --target /pip-packages --no-cache-dir --upgrade \ + distlib && \ + pip install --no-cache-dir --upgrade \ + cython \ + "pip>=21.0,<22.1" \ + setuptools \ + wheel && \ + cd /tmp/core && \ + pip install ${PIPFLAGS} \ + -r https://raw.githubusercontent.com/home-assistant/docker/${HASS_BASE}/requirements.txt && \ + pip install ${PIPFLAGS} \ + -r requirements_all.txt --no-binary grpcio && \ + pip install ${PIPFLAGS} \ + homeassistant==${HASS_RELEASE} && \ + pip install ${PIPFLAGS} \ + PySwitchbot && \ + echo "**** cleanup ****" && \ + apk del --purge \ + build-dependencies && \ + for cleanfiles in *.pyc *.pyo; \ + do \ + find /usr/lib/python3.* -iname "${cleanfiles}" -exec rm -f '{}' + \ + ; done && \ + rm -rf \ + /tmp/* \ + /root/.cache \ + /root/.cargo # environment settings. used so pip packages installed by home assistant installs in /config ENV HOME="/config" diff --git a/root/etc/cont-init.d/60-usb-gid b/root/etc/cont-init.d/60-usb-gid index c663f96..36265d1 100644 --- a/root/etc/cont-init.d/60-usb-gid +++ b/root/etc/cont-init.d/60-usb-gid @@ -4,23 +4,23 @@ FILES=$(find /dev/ttyACM* /dev/ttyUSB* -type c -print 2>/dev/null) for i in $FILES do - USB_GID=$(stat -c '%g' "$i") - if id -G abc | grep -qw "$USB_GID"; then - touch /groupadd - else - if [ ! "${USB_GID}" == '0' ]; then - USB_NAME=$(getent group "${USB_GID}" | awk -F: '{print $1}') - if [ -z "${USB_NAME}" ]; then - USB_NAME="usb$(head /dev/urandom | tr -dc 'a-z0-9' | head -c8)" - groupadd "$USB_NAME" - groupmod -g "$USB_GID" "$USB_NAME" - fi - usermod -a -G "$USB_NAME" abc - touch /groupadd - fi + USB_GID=$(stat -c '%g' "$i") + if id -G abc | grep -qw "$USB_GID"; then + touch /groupadd + else + if [ ! "${USB_GID}" == '0' ]; then + USB_NAME=$(getent group "${USB_GID}" | awk -F: '{print $1}') + if [ -z "${USB_NAME}" ]; then + USB_NAME="usb$(head /dev/urandom | tr -dc 'a-z0-9' | head -c8)" + groupadd "$USB_NAME" + groupmod -g "$USB_GID" "$USB_NAME" + fi + usermod -a -G "$USB_NAME" abc + touch /groupadd fi + fi done if [ -n "${FILES}" ] && [ ! -f "/groupadd" ]; then - usermod -a -G root abc + usermod -a -G root abc fi diff --git a/root/etc/services.d/homeassistant/run b/root/etc/services.d/homeassistant/run index 2eea82e..8e0d809 100644 --- a/root/etc/services.d/homeassistant/run +++ b/root/etc/services.d/homeassistant/run @@ -3,5 +3,5 @@ setcap 'cap_net_bind_service=+ep' /usr/bin/python3.9 exec \ - s6-setuidgid abc /usr/bin/hass \ - -c /config + s6-setuidgid abc /usr/bin/hass \ + -c /config