From 30b5529df8c50146f2bd816f4b38bba471e92e3e Mon Sep 17 00:00:00 2001 From: cronekorkn Date: Tue, 11 Jun 2024 18:24:01 +0200 Subject: [PATCH] wip --- bundles/homeassistant-supervised/README.md | 8 +++ bundles/homeassistant-supervised/items.py | 38 +++-------- bundles/homeassistant/items.py | 37 ----------- bundles/homeassistant/metadata.py | 73 ---------------------- groups/os/homeassistant-supervised.py | 46 -------------- 5 files changed, 18 insertions(+), 184 deletions(-) delete mode 100644 bundles/homeassistant/items.py delete mode 100644 bundles/homeassistant/metadata.py delete mode 100644 groups/os/homeassistant-supervised.py diff --git a/bundles/homeassistant-supervised/README.md b/bundles/homeassistant-supervised/README.md index 533b101..aada33e 100644 --- a/bundles/homeassistant-supervised/README.md +++ b/bundles/homeassistant-supervised/README.md @@ -1,3 +1,11 @@ +https://github.com/home-assistant/supervised-installer?tab=readme-ov-file +https://github.com/home-assistant/os-agent/tree/main?tab=readme-ov-file#using-home-assistant-supervised-on-debian +https://docs.docker.com/engine/install/debian/ + + + + + https://www.home-assistant.io/installation/linux#install-home-assistant-supervised https://github.com/home-assistant/supervised-installer https://github.com/home-assistant/architecture/blob/master/adr/0014-home-assistant-supervised.md diff --git a/bundles/homeassistant-supervised/items.py b/bundles/homeassistant-supervised/items.py index 1a6e7ab..925a5e4 100644 --- a/bundles/homeassistant-supervised/items.py +++ b/bundles/homeassistant-supervised/items.py @@ -14,34 +14,16 @@ actions = { 'DEBIAN_FRONTEND=noninteractive dpkg -i /tmp/os-agent.deb', ]), 'unless': f'test "$(apt -qq list os-agent | cut -d" " -f2)" = "{quote(version)}"', + 'needs': { + 'pkg_apt:', + }, + }, + 'install_homeassistant_supervised': { + 'command': 'wget -O /tmp/homeassistant-supervised.deb https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb && apt install /tmp/homeassistant-supervised.deb', + 'unless': 'apt -qq list homeassistant-supervised | grep -q "installed"', + 'needs': { + 'action:install_os_agent', + }, }, } -# svc_systemd = { -# 'docker.service': { -# 'needs': [ -# 'pkg_apt:docker-ce', -# 'pkg_apt:docker-ce-cli', -# 'pkg_apt:containerd.io', -# 'pkg_apt:docker-buildx-plugin', -# 'pkg_apt:docker-compose-plugin', -# ], -# }, -# } - - -# TODO: keep up to date: -# https://github.com/home-assistant/os-agent/releases/latest - - - - -# direct link to latest version download: https://github.com/home-assistant/os-agent/releases/download/latest/os-agent_latest_linux_aarch64.deb - - -# TODO: keep NetworkManager - - -# https://github.com/home-assistant/supervised-installer?tab=readme-ov-file -# https://github.com/home-assistant/os-agent/tree/main?tab=readme-ov-file#using-home-assistant-supervised-on-debian -# https://docs.docker.com/engine/install/debian/ diff --git a/bundles/homeassistant/items.py b/bundles/homeassistant/items.py deleted file mode 100644 index a94562c..0000000 --- a/bundles/homeassistant/items.py +++ /dev/null @@ -1,37 +0,0 @@ -# users = { -# 'homeassistant': { -# 'home': '/opt/homeassistant', -# 'groups': [ -# 'dialout', -# #'gpio', -# #'i2c', -# ], -# }, -# } - -# directories = { -# '/opt/homeassistant': { -# 'owner': 'homeassistant', -# 'group': 'homeassistant', -# }, -# '/opt/homeassistant/data': { -# 'owner': 'homeassistant', -# 'group': 'homeassistant', -# }, -# '/opt/homeassistant/venv': { -# 'owner': 'homeassistant', -# 'group': 'homeassistant', -# }, -# } - -# svc_systemd = { -# 'homeassistant.service': {}, -# } - -# venv manually managed for now -''' -python3 -m venv /opt/homeassistant/venv -source /opt/homeassistant/venv/bin/activate -python3 -m pip install wheel -pip3 install homeassistant -''' diff --git a/bundles/homeassistant/metadata.py b/bundles/homeassistant/metadata.py deleted file mode 100644 index 95f7646..0000000 --- a/bundles/homeassistant/metadata.py +++ /dev/null @@ -1,73 +0,0 @@ -defaults = { - 'apt': { - 'packages': { - 'python3': {}, - 'python3-dev': {}, - 'python3-pip': {}, - 'python3-venv': {}, - 'libffi-dev': {}, - 'libssl-dev': {}, - 'libjpeg-dev': {}, - 'zlib1g-dev': {}, - 'autoconf': {}, - 'build-essential': {}, - 'libopenjp2-7': {}, - 'libturbojpeg0-dev': {}, - 'tzdata': {}, - 'bluez': {}, - 'libtiff6': {}, - 'ffmpeg': {}, - 'liblapack3': {}, - 'liblapack-dev': {}, - 'libatlas-base-dev': {}, - 'libpcap-dev': {}, - }, - }, - # 'systemd': { - # 'units': { - # f'homeassistant.service': { - # 'Unit': { - # 'Description': "Home Assstant", - # 'After': 'network.target', - # }, - # 'Service': { - # 'User': 'homeassistant', - # 'Group': 'homeassistant', - # 'WorkingDirectory': "/opt/homeassistant", - # 'ExecStart': "/opt/homeassistant/venv/bin/python3 /opt/homeassistant/venv/bin/hass -c /opt/homeassistant/data --debug", - # }, - # 'Install': { - # 'WantedBy': { - # 'multi-user.target' - # }, - # }, - # } - # }, - # }, - # 'zfs': { - # 'datasets': { - # 'tank/homeassistant': { - # 'mountpoint': '/opt/homeassistant/data', - # 'needed_by': { - # 'user:homeassistant', - # 'directory:/opt/homeassistant', - # }, - # }, - # }, - # }, -} - - -@metadata_reactor.provides( - 'nginx/vhosts', -) -def nginx(metadata): - return { - 'nginx': { - 'vhosts': { - metadata.get('homeassistant/domain'): { - 'content': 'homeassistant/vhost.conf', - }, - }, - }, - } diff --git a/groups/os/homeassistant-supervised.py b/groups/os/homeassistant-supervised.py deleted file mode 100644 index ad1d2c1..0000000 --- a/groups/os/homeassistant-supervised.py +++ /dev/null @@ -1,46 +0,0 @@ -{ - 'supergroups': [ - 'all', - ], - 'bundles': [ - 'apt', - 'homeassistant-supervised', - ], - 'metadata': { - 'apt': { - 'sources': { - 'debian': { - 'urls': { - 'https://deb.debian.org/debian', - }, - 'suites': { - '{codename}', - '{codename}-updates', - }, - 'components': { - 'main', - 'contrib', - 'non-free', - 'non-free-firmware', - }, - 'key': 'debian-{version}', - }, - 'debian-security': { - 'urls': { - 'http://security.debian.org/debian-security', - }, - 'suites': { - '{codename}-security', - }, - 'components': { - 'main', - 'contrib', - 'non-free', - 'non-free-firmware', - }, - 'key': 'debian-{version}-security', - }, - }, - }, - }, -}